From c3fb9efaaf1c57e6027b0a663d4da274d45004e5 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 5 Aug 2018 00:05:47 -0400 Subject: [PATCH] Debug env --- hosts.go | 4 +++- settings.go | 20 ++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hosts.go b/hosts.go index db0d121..6469174 100644 --- a/hosts.go +++ b/hosts.go @@ -5,7 +5,7 @@ import ( "time" "github.com/hoisie/redis" -) + ) type Hosts struct { providers []HostProvider @@ -23,6 +23,8 @@ func NewHosts(hs HostsSettings, rs RedisSettings) Hosts { } if hs.RedisEnable { + logger.Info("Redis is enabled: %s", rs.Addr()) + rc := &redis.Client{Addr: rs.Addr(), Db: rs.DB, Password: rs.Password} providers = append(providers, NewRedisProvider(rc, hs.RedisKey)) diff --git a/settings.go b/settings.go index 9a462e8..ed84d08 100644 --- a/settings.go +++ b/settings.go @@ -7,7 +7,6 @@ import ( "strconv" "github.com/BurntSushi/toml" - "reflect" "github.com/caarlos0/env" ) @@ -105,17 +104,10 @@ func init() { os.Exit(1) } - val := reflect.ValueOf(settings) - - for i := 0; i < val.NumField(); i++ { - f := val.Field(i) - - if f.Kind() != reflect.Struct { - continue - } - - v := f.Interface() - - env.Parse(&v) - } + env.Parse(&settings.ResolvConfig) + env.Parse(&settings.Redis) + env.Parse(&settings.Memcache) + env.Parse(&settings.Log) + env.Parse(&settings.Cache) + env.Parse(&settings.Hosts) } \ No newline at end of file