Beispiel #1
0
func addConfigToEnv(keyPrefix string, conf map[string]interface{}, ev *env.Env) {
	for k, v := range conf {
		key := keyPrefix + k
		switch t := v.(type) {
		case string:
			ev.Set(key, t)
		case int64:
			ev.Set(key, strconv.FormatInt(t, 10))
		case float64:
			ev.Set(key, strconv.FormatFloat(t, 'f', -1, 64))
		case map[string]interface{}:
			addConfigToEnv(key+"_", t, ev)
		}
	}
}