agent: Adding UiDir config param
This commit is contained in:
parent
ec004dd062
commit
47f6cef91d
|
@ -124,6 +124,10 @@ type Config struct {
|
|||
// addresses, then the agent will error and exit.
|
||||
StartJoin []string `mapstructure:"start_join"`
|
||||
|
||||
// UiDir is the directory containing the Web UI resources.
|
||||
// If provided, the UI endpoints will be enabled.
|
||||
UiDir string `mapstructure:"ui_dir"`
|
||||
|
||||
// AEInterval controls the anti-entropy interval. This is how often
|
||||
// the agent attempts to reconcile it's local state with the server'
|
||||
// representation of our state. Defaults to every 60s.
|
||||
|
@ -416,6 +420,9 @@ func MergeConfig(a, b *Config) *Config {
|
|||
if b.Ports.Server != 0 {
|
||||
result.Ports.Server = b.Ports.Server
|
||||
}
|
||||
if b.UiDir != "" {
|
||||
result.UiDir = b.UiDir
|
||||
}
|
||||
|
||||
// Copy the start join addresses
|
||||
result.StartJoin = make([]string, 0, len(a.StartJoin)+len(b.StartJoin))
|
||||
|
|
|
@ -246,6 +246,17 @@ func TestDecodeConfig(t *testing.T) {
|
|||
if config.StartJoin[1] != "2.2.2.2" {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
|
||||
// UI Dir
|
||||
input = `{"ui_dir": "/opt/consul-ui"}`
|
||||
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if config.UiDir != "/opt/consul-ui" {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeConfig_Service(t *testing.T) {
|
||||
|
@ -377,6 +388,7 @@ func TestMergeConfig(t *testing.T) {
|
|||
Checks: []*CheckDefinition{nil},
|
||||
Services: []*ServiceDefinition{nil},
|
||||
StartJoin: []string{"1.1.1.1"},
|
||||
UiDir: "/opt/consul-ui",
|
||||
}
|
||||
|
||||
c := MergeConfig(a, b)
|
||||
|
|
Loading…
Reference in New Issue