mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 06:16:08 +00:00
agent: Adding UiDir config param
This commit is contained in:
parent
10fb856dad
commit
2605b8e27c
@ -124,6 +124,10 @@ type Config struct {
|
|||||||
// addresses, then the agent will error and exit.
|
// addresses, then the agent will error and exit.
|
||||||
StartJoin []string `mapstructure:"start_join"`
|
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
|
// AEInterval controls the anti-entropy interval. This is how often
|
||||||
// the agent attempts to reconcile it's local state with the server'
|
// the agent attempts to reconcile it's local state with the server'
|
||||||
// representation of our state. Defaults to every 60s.
|
// representation of our state. Defaults to every 60s.
|
||||||
@ -416,6 +420,9 @@ func MergeConfig(a, b *Config) *Config {
|
|||||||
if b.Ports.Server != 0 {
|
if b.Ports.Server != 0 {
|
||||||
result.Ports.Server = b.Ports.Server
|
result.Ports.Server = b.Ports.Server
|
||||||
}
|
}
|
||||||
|
if b.UiDir != "" {
|
||||||
|
result.UiDir = b.UiDir
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the start join addresses
|
// Copy the start join addresses
|
||||||
result.StartJoin = make([]string, 0, len(a.StartJoin)+len(b.StartJoin))
|
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" {
|
if config.StartJoin[1] != "2.2.2.2" {
|
||||||
t.Fatalf("bad: %#v", config)
|
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) {
|
func TestDecodeConfig_Service(t *testing.T) {
|
||||||
@ -377,6 +388,7 @@ func TestMergeConfig(t *testing.T) {
|
|||||||
Checks: []*CheckDefinition{nil},
|
Checks: []*CheckDefinition{nil},
|
||||||
Services: []*ServiceDefinition{nil},
|
Services: []*ServiceDefinition{nil},
|
||||||
StartJoin: []string{"1.1.1.1"},
|
StartJoin: []string{"1.1.1.1"},
|
||||||
|
UiDir: "/opt/consul-ui",
|
||||||
}
|
}
|
||||||
|
|
||||||
c := MergeConfig(a, b)
|
c := MergeConfig(a, b)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user