config_parse split out defaults from ParseConfig
This commit is contained in:
parent
93e7f60be5
commit
ad56434472
|
@ -14,6 +14,15 @@ import (
|
||||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
"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) {
|
func ParseConfigFile(path string) (*Config, error) {
|
||||||
// slurp
|
// slurp
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
@ -36,10 +45,10 @@ func ParseConfigFile(path string) (*Config, error) {
|
||||||
Client: &ClientConfig{ServerJoin: &ServerJoin{}},
|
Client: &ClientConfig{ServerJoin: &ServerJoin{}},
|
||||||
ACL: &ACLConfig{},
|
ACL: &ACLConfig{},
|
||||||
Server: &ServerConfig{ServerJoin: &ServerJoin{}},
|
Server: &ServerConfig{ServerJoin: &ServerJoin{}},
|
||||||
Consul: config.DefaultConsulConfig(),
|
Consul: &config.ConsulConfig{},
|
||||||
Autopilot: config.DefaultAutopilotConfig(),
|
Autopilot: &config.AutopilotConfig{},
|
||||||
Telemetry: &Telemetry{},
|
Telemetry: &Telemetry{},
|
||||||
Vault: config.DefaultVaultConfig(),
|
Vault: &config.VaultConfig{},
|
||||||
}
|
}
|
||||||
|
|
||||||
err = hcl.Decode(c, buf.String())
|
err = hcl.Decode(c, buf.String())
|
||||||
|
|
Loading…
Reference in New Issue