summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/ponzu/main.go1
-rw-r--r--system/db/config.go12
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))