Commit a775c979 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/digitalocean: Scrub sensitive information out of logs

/cc @pearkes
parent bb5b12d7
......@@ -166,12 +166,15 @@ func (d DigitalOceanClient) DropletStatus(id uint) (string, string, error) {
// the response.
func NewRequest(d DigitalOceanClient, path string, params string) (map[string]interface{}, error) {
client := d.client
url := fmt.Sprintf("%v/%v?%v&client_id=%v&api_key=%v",
url := fmt.Sprintf("%s/%s?%s&client_id=%s&api_key=%s",
DIGITALOCEAN_API_URL, path, params, d.ClientID, d.APIKey)
var decodedResponse map[string]interface{}
log.Printf("sending new request to digitalocean: %v", url)
// Do some basic scrubbing so sensitive information doesn't appear in logs
scrubbedUrl := strings.Replace(url, d.ClientID, "CLIENT_ID")
scrubbedUrl := strings.Replace(url, d.APIKey, "API_KEY")
log.Printf("sending new request to digitalocean: %s", scrubbedUrl)
resp, err := client.Get(url)
if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment