From ad56434472f34257917fffcbe36245275574fd30 Mon Sep 17 00:00:00 2001 From: Lang Martin Date: Tue, 11 Jun 2019 15:14:24 -0400 Subject: [PATCH] config_parse split out defaults from ParseConfig --- command/agent/config_parse.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/command/agent/config_parse.go b/command/agent/config_parse.go index af9a1f5c2..201508f6c 100644 --- a/command/agent/config_parse.go +++ b/command/agent/config_parse.go @@ -14,6 +14,15 @@ import ( "github.com/hashicorp/nomad/nomad/structs/config" ) +// ParseConfigDefault returns the configuration base +func ParseConfigDefault() *Config { + return &Config{ + Consul: config.DefaultConsulConfig(), + Autopilot: config.DefaultAutopilotConfig(), + Vault: config.DefaultVaultConfig(), + } +} + func ParseConfigFile(path string) (*Config, error) { // slurp var buf bytes.Buffer @@ -36,10 +45,10 @@ func ParseConfigFile(path string) (*Config, error) { Client: &ClientConfig{ServerJoin: &ServerJoin{}}, ACL: &ACLConfig{}, Server: &ServerConfig{ServerJoin: &ServerJoin{}}, - Consul: config.DefaultConsulConfig(), - Autopilot: config.DefaultAutopilotConfig(), + Consul: &config.ConsulConfig{}, + Autopilot: &config.AutopilotConfig{}, Telemetry: &Telemetry{}, - Vault: config.DefaultVaultConfig(), + Vault: &config.VaultConfig{}, } err = hcl.Decode(c, buf.String())