diff options
Diffstat (limited to 'crawler/config.go')
| -rw-r--r-- | crawler/config.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crawler/config.go b/crawler/config.go index 9ee95b7..f89fa45 100644 --- a/crawler/config.go +++ b/crawler/config.go @@ -21,9 +21,9 @@ type Config struct { Polr_URL string Polr_API_Key string - Debug bool - FixDatabase bool - ShopIDs []string + Debug bool // sets log level to debug + FixDatabase bool // reruns some sanitizing functions over the db + ShopIDs []string // limits which shops to crawl, wants shop_id } // Parses the configuration and sets the configuration struct. @@ -56,12 +56,15 @@ func (c *Config) parseConfig(configFile string) { // provided config file does not exist, so we add the path instead viper.AddConfigPath(configFile) } else if err == nil && stat.IsDir() { + // adds the path to look for the config file viper.AddConfigPath(configFile) } else if err == nil { // directly sets the config file viper.SetConfigFile(configFile) } else { - Warn(err, "config.go: os.Stat("+configFile+")") + // if we are here something went wrong + Warn(err, "config.go: os.Stat("+configFile+") error") + // adding the path nonetheless because it's not hurting viper.AddConfigPath(configFile) } } |
