Skip to content

Commit

Permalink
Add API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrendek committed May 29, 2017
1 parent 7568c29 commit 0f7c04d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ func (login *SshLogin) Save() {
}

func PostToApi(endpoint string, post_data *strings.Reader) {
apiKey := os.Getenv("API_KEY")
server_url := os.Getenv("SERVER_URL")
if server_url == "" {
server_url = "https://sshpot.com"
server_url = "https://hnypots.com"
}
ssh_api := fmt.Sprintf("%s/api/%s", server_url, endpoint)
ssh_api := fmt.Sprintf("%s/api/%s?api_key=%s", server_url, endpoint, apiKey)
req, err := http.NewRequest("POST", ssh_api, post_data)
log.Println(fmt.Sprintf("[post] %s", ssh_api))

Expand Down

0 comments on commit 0f7c04d

Please sign in to comment.