summaryrefslogtreecommitdiff
path: root/crawler
diff options
context:
space:
mode:
authorhorus_arch2018-02-17 15:22:51 +0100
committerhorus_arch2018-02-17 15:22:51 +0100
commit8a94fd9d4b54e05ecd11ce4bc1fd9b0feb92b239 (patch)
tree224cb505fcc05748cc23b131607194c0dfaec8bc /crawler
parentfc83917d623228b09191f178062e59fad0722795 (diff)
downloadalkobote-8a94fd9d4b54e05ecd11ce4bc1fd9b0feb92b239.tar.gz
Sets config option to disable url shorter. (crawler)
Diffstat (limited to 'crawler')
-rw-r--r--crawler/config.go23
-rw-r--r--crawler/post_process.go8
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 {