From 2c5f742fa35ed347f8f700d6f238010e0cab95b0 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Thu, 10 Oct 2013 15:01:07 -0700 Subject: [PATCH] builder/digitalocean: Scrub config before logging [GH-516] --- builder/digitalocean/builder.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 8e74ec9b1..f8a25b4b3 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -11,6 +11,7 @@ import ( "github.com/mitchellh/packer/packer" "log" "os" + "strings" "time" ) @@ -164,7 +165,10 @@ func (b *Builder) Prepare(raws ...interface{}) error { return errs } - log.Printf("Config: %+v", b.config) + configRepr := fmt.Sprintf("Config: %+v", b.config) + scrubbedConfig := strings.Replace(configRepr, b.config.ClientID, "CLIENT_ID", -1) + scrubbedConfig = strings.Replace(scrubbedConfig, b.config.APIKey, "API_KEY", -1) + log.Println(scrubbedConfig) return nil }