From 73634fea62cac6e50803e27df5848c72b6dc30fa Mon Sep 17 00:00:00 2001 From: horus Date: Wed, 21 Feb 2018 01:37:40 +0100 Subject: Adds some docu. (crawler) --- crawler/config.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'crawler/config.go') 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) } } -- cgit v1.2.3