diff options
Diffstat (limited to 'crawler')
| -rw-r--r-- | crawler/config.go | 23 | ||||
| -rw-r--r-- | crawler/post_process.go | 8 |
2 files changed, 20 insertions, 11 deletions
diff --git a/crawler/config.go b/crawler/config.go index 2eb7d03..c9b17a4 100644 --- a/crawler/config.go +++ b/crawler/config.go @@ -5,16 +5,17 @@ import ( ) type Config struct { - DBDriver string - DBDBName string - DBHost string - DBPort string - DBUser string - DBPassword string - DBOptions string - DBPath string // for sqlite - Polr_URL string - Polr_API_Key string + DBDriver string + DBDBName string + DBHost string + DBPort string + DBUser string + DBPassword string + DBOptions string + DBPath string // for sqlite + DisableURLShorter bool + Polr_URL string + Polr_API_Key string Debug bool } @@ -30,6 +31,7 @@ func (c *Config) parseConfig(configFile string) { viper.SetDefault("DB_Path", "./alkobote.db") viper.SetDefault("Debug", false) + viper.SetDefault("DisableURLShorter", false) // Name of the configuration file viper.SetConfigName("config") @@ -70,6 +72,7 @@ func (c *Config) setsConfig() { c.DBOptions = viper.GetString("DB_Options") c.DBPath = viper.GetString("DB_Path") c.Debug = viper.GetBool("Debug") + c.DisableURLShorter = viper.GetBool("DisableURLShorter") c.Polr_URL = viper.GetString("Polr_URL") c.Polr_API_Key = viper.GetString("Polr_API_Key") } diff --git a/crawler/post_process.go b/crawler/post_process.go index 4688cc8..40845b9 100644 --- a/crawler/post_process.go +++ b/crawler/post_process.go @@ -10,7 +10,13 @@ import ( func (app *App) post_process() error { - return app.short_url() + if app.Config.DisableURLShorter { + log.Debug("post_process.go: URL Shorter is disabled (via config)") + return nil + } else { + return app.short_url() + } + } func (app *App) short_url() error { |
