diff --git a/command/agent/config.go b/command/agent/config.go index 223c446c00..ad8a8b8754 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -100,6 +100,9 @@ type Config struct { // Protocol is the Consul protocol version to use. Protocol int `mapstructure:"protocol"` + // EnableDebug is used to enable various debugging features + EnableDebug bool `mapstructure:"enable_debug"` + // Checks holds the provided check definitions Checks []*CheckDefinition `mapstructure:"-"` @@ -321,6 +324,9 @@ func MergeConfig(a, b *Config) *Config { if b.SkipLeaveOnInt == true { result.SkipLeaveOnInt = true } + if b.EnableDebug { + result.EnableDebug = true + } if b.Checks != nil { result.Checks = append(result.Checks, b.Checks...) } diff --git a/command/agent/config_test.go b/command/agent/config_test.go index 008e8be0f6..878e61a0e7 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -182,6 +182,17 @@ func TestDecodeConfig(t *testing.T) { if config.SkipLeaveOnInt != true { t.Fatalf("bad: %#v", config) } + + // enable_debug + input = `{"enable_debug": true}` + config, err = DecodeConfig(bytes.NewReader([]byte(input))) + if err != nil { + t.Fatalf("err: %s", err) + } + + if config.EnableDebug != true { + t.Fatalf("bad: %#v", config) + } } func TestDecodeConfig_Service(t *testing.T) { @@ -284,6 +295,7 @@ func TestMergeConfig(t *testing.T) { Server: false, LeaveOnTerm: false, SkipLeaveOnInt: false, + EnableDebug: false, } b := &Config{ @@ -305,6 +317,7 @@ func TestMergeConfig(t *testing.T) { Server: true, LeaveOnTerm: true, SkipLeaveOnInt: true, + EnableDebug: true, Checks: []*CheckDefinition{nil}, Services: []*ServiceDefinition{nil}, }