aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2017-06-18 06:31:48 +0000
committerFelix Hanley <felix@userspace.com.au>2017-06-18 06:31:48 +0000
commitde6c420e7706c5705b3b48e545c9c5fd81ab851c (patch)
tree02f1e2f41ce25acb0bd3e4f5a906a997ca3545d9
parentec94ce62fc7b453d6fc0bf0a3d5eae92776096f7 (diff)
downloaddhtsearch-de6c420e7706c5705b3b48e545c9c5fd81ab851c.tar.gz
dhtsearch-de6c420e7706c5705b3b48e545c9c5fd81ab851c.tar.bz2
Ensure the default set of tags are skipped
-rw-r--r--config.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/config.go b/config.go
index 2786ec4..a18d479 100644
--- a/config.go
+++ b/config.go
@@ -32,15 +32,16 @@ type advancedConfig struct {
func loadConfig() {
if _, err := os.Stat("config.toml"); !os.IsNotExist(err) {
- md, err := toml.DecodeFile("config.toml", &Config)
+ _, err := toml.DecodeFile("config.toml", &Config)
if err != nil {
fmt.Printf("Failed to read configuration: %q\n", err)
os.Exit(1)
}
+ }
- if !md.IsDefined("SkipTags") {
- Config.SkipTags = []string{"adult"}
- }
+ // Leave it to the user to get around this
+ if len(Config.SkipTags) == 0 {
+ Config.SkipTags = []string{"adult"}
}
flag.IntVar(&Config.BasePort, "base-port", 6881, "listen port (and first of multiple ports)")