瀏覽代碼

ignoring config when using custom config (#362)

Zachary Rice 6 年之前
父節點
當前提交
9db91442b3
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      config/config.go

+ 3 - 0
config/config.go

@@ -2,6 +2,7 @@ package config
 
 import (
 	"fmt"
+	"path"
 	"regexp"
 	"strconv"
 
@@ -94,6 +95,8 @@ func NewConfig(options options.Options) (Config, error) {
 	var err error
 	if options.Config != "" {
 		_, err = toml.DecodeFile(options.Config, &tomlLoader)
+		// append a whitelist rule for whitelisting the config
+		tomlLoader.Whitelist.Files = append(tomlLoader.Whitelist.Files, path.Base(options.Config))
 	} else {
 		_, err = toml.Decode(DefaultConfig, &tomlLoader)
 	}