Debug env
This commit is contained in:
parent
b5e5fede9a
commit
c3fb9efaaf
2
hosts.go
2
hosts.go
|
@ -23,6 +23,8 @@ func NewHosts(hs HostsSettings, rs RedisSettings) Hosts {
|
||||||
}
|
}
|
||||||
|
|
||||||
if hs.RedisEnable {
|
if hs.RedisEnable {
|
||||||
|
logger.Info("Redis is enabled: %s", rs.Addr())
|
||||||
|
|
||||||
rc := &redis.Client{Addr: rs.Addr(), Db: rs.DB, Password: rs.Password}
|
rc := &redis.Client{Addr: rs.Addr(), Db: rs.DB, Password: rs.Password}
|
||||||
|
|
||||||
providers = append(providers, NewRedisProvider(rc, hs.RedisKey))
|
providers = append(providers, NewRedisProvider(rc, hs.RedisKey))
|
||||||
|
|
20
settings.go
20
settings.go
|
@ -7,7 +7,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
"reflect"
|
|
||||||
"github.com/caarlos0/env"
|
"github.com/caarlos0/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -105,17 +104,10 @@ func init() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
val := reflect.ValueOf(settings)
|
env.Parse(&settings.ResolvConfig)
|
||||||
|
env.Parse(&settings.Redis)
|
||||||
for i := 0; i < val.NumField(); i++ {
|
env.Parse(&settings.Memcache)
|
||||||
f := val.Field(i)
|
env.Parse(&settings.Log)
|
||||||
|
env.Parse(&settings.Cache)
|
||||||
if f.Kind() != reflect.Struct {
|
env.Parse(&settings.Hosts)
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
v := f.Interface()
|
|
||||||
|
|
||||||
env.Parse(&v)
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue