From 006a9a1d454739eee21b7d8abb8b7aef1353b648 Mon Sep 17 00:00:00 2001 From: Lang Martin Date: Tue, 11 Jun 2019 15:15:52 -0400 Subject: [PATCH] config explicitly merge defaults once when using a config directory --- command/agent/config.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/command/agent/config.go b/command/agent/config.go index 773adbc1754..c5128a4772c 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -1461,8 +1461,14 @@ func LoadConfig(path string) (*Config, error) { return nil, err } + defaults := ParseConfigDefault() + if fi.IsDir() { - return LoadConfigDir(path) + config, err := LoadConfigDir(path) + if err != nil { + return nil, err + } + return defaults.Merge(config), nil } cleaned := filepath.Clean(path) @@ -1470,7 +1476,7 @@ func LoadConfig(path string) (*Config, error) { if err != nil { return nil, fmt.Errorf("Error loading %s: %s", cleaned, err) } - + config = defaults.Merge(config) config.Files = append(config.Files, cleaned) return config, nil }