diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-12-19 09:17:53 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-12-19 09:17:53 -0800 |
commit | 6a49024e0ba2f03578164bf64a7d15ac056e591b (patch) | |
tree | 6fae36db56e0764f6662bcdc1fb28ca42edd9822 | |
parent | af0ed656e813eb2ada2f596c9c957f3e679b3cba (diff) |
contin. debugging host port issue in config
-rw-r--r-- | cmd/ponzu/main.go | 1 | ||||
-rw-r--r-- | system/db/config.go | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index b2b5e75..b77b7c9 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -296,6 +296,7 @@ func main() { // save the port the system is listening on so internal system can make // HTTP api calls while in dev or production w/o adding more cli flags + fmt.Println(port, "port from main") err := db.PutConfig("http_port", fmt.Sprintf("%d", port)) if err != nil { log.Fatalln("System failed to save config. Please try to run again.") diff --git a/system/db/config.go b/system/db/config.go index 5cbdd2a..5122e41 100644 --- a/system/db/config.go +++ b/system/db/config.go @@ -137,9 +137,18 @@ func PutConfig(key string, value interface{}) error { data := make(url.Values) for k, v := range kv { switch v.(type) { + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: + data.Set(k, fmt.Sprintf("%d", v)) + + case float32, float64: + data.Set(k, fmt.Sprintf("%f", v)) + + case bool: + data.Set(k, fmt.Sprintf("%t", v)) + case string: - fmt.Println("type string:", v) data.Set(k, v.(string)) + case []string: vv := v.([]string) for i := range vv { @@ -149,6 +158,7 @@ func PutConfig(key string, value interface{}) error { data.Add(k, vv[i]) } } + default: log.Println("No type case for:", k, v, "in PutConfig") data.Set(k, fmt.Sprintf("%v", v)) |