From b07f2f99730af300fdbe4e78c72c94241b171e64 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 8 Apr 2012 10:58:34 -0700 Subject: [PATCH] Debug environment variable to CAMLI_DEBUG_CONFIG dump low-level config. Change-Id: I7e7830112b8f10c5695ad53fd867fb5736925cef --- pkg/serverconfig/serverconfig.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/serverconfig/serverconfig.go b/pkg/serverconfig/serverconfig.go index ff103cedf..5022a4b8f 100644 --- a/pkg/serverconfig/serverconfig.go +++ b/pkg/serverconfig/serverconfig.go @@ -17,11 +17,13 @@ limitations under the License. package serverconfig import ( + "encoding/json" "errors" "fmt" "log" "net/http" "os" + "strconv" "strings" "camlistore.org/pkg/auth" @@ -301,6 +303,10 @@ func Load(filename string) (*Config, error) { "Failed to transform user config file %q into internal handler configuration: %v", filename, err) } + if v, _ := strconv.ParseBool(os.Getenv("CAMLI_DEBUG_CONFIG")); v { + jsconf, _ := json.MarshalIndent(conf.Obj, "", " ") + log.Printf("From high-level config, generated low-level config: %s", jsconf) + } } return conf, nil