mirror of https://github.com/status-im/consul.git
agent: atlas_endpoint is configurable
This commit is contained in:
parent
b0fcb6c234
commit
1cc2429364
|
@ -363,6 +363,10 @@ type Config struct {
|
|||
// to it's cluster. Requires Atlas integration.
|
||||
AtlasJoin bool `mapstructure:"atlas_join"`
|
||||
|
||||
// AtlasEndpoint is the SCADA endpoint used for Atlas integration. If
|
||||
// empty, the defaults from the provider are used.
|
||||
AtlasEndpoint string `mapstructure:"atlas_endpoint"`
|
||||
|
||||
// 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.
|
||||
|
@ -1056,6 +1060,9 @@ func MergeConfig(a, b *Config) *Config {
|
|||
if b.AtlasJoin {
|
||||
result.AtlasJoin = true
|
||||
}
|
||||
if b.AtlasEndpoint != "" {
|
||||
result.AtlasEndpoint = b.AtlasEndpoint
|
||||
}
|
||||
if b.SessionTTLMinRaw != "" {
|
||||
result.SessionTTLMin = b.SessionTTLMin
|
||||
result.SessionTTLMinRaw = b.SessionTTLMinRaw
|
||||
|
|
|
@ -706,7 +706,13 @@ func TestDecodeConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
// Atlas configs
|
||||
input = `{"atlas_infrastructure": "hashicorp/prod", "atlas_token": "abcdefg", "atlas_acl_token": "123456789", "atlas_join": true}`
|
||||
input = `{
|
||||
"atlas_infrastructure": "hashicorp/prod",
|
||||
"atlas_token": "abcdefg",
|
||||
"atlas_acl_token": "123456789",
|
||||
"atlas_join": true,
|
||||
"atlas_endpoint": "foo.bar:1111"
|
||||
}`
|
||||
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
@ -724,6 +730,9 @@ func TestDecodeConfig(t *testing.T) {
|
|||
if !config.AtlasJoin {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
if config.AtlasEndpoint != "foo.bar:1111" {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
}
|
||||
|
||||
// SessionTTLMin
|
||||
input = `{"session_ttl_min": "5s"}`
|
||||
|
|
|
@ -47,6 +47,7 @@ func ProviderConfig(c *Config) *client.ProviderConfig {
|
|||
Handlers: map[string]client.CapabilityProvider{
|
||||
"http": nil,
|
||||
},
|
||||
Endpoint: c.AtlasEndpoint,
|
||||
ResourceGroup: c.AtlasInfrastructure,
|
||||
Token: c.AtlasToken,
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ func TestProviderConfig(t *testing.T) {
|
|||
conf.Server = true
|
||||
conf.AtlasInfrastructure = "armon/test"
|
||||
conf.AtlasToken = "foobarbaz"
|
||||
conf.AtlasEndpoint = "foo.bar:1111"
|
||||
pc := ProviderConfig(conf)
|
||||
|
||||
expect := &client.ProviderConfig{
|
||||
|
@ -62,6 +63,7 @@ func TestProviderConfig(t *testing.T) {
|
|||
Handlers: map[string]client.CapabilityProvider{
|
||||
"http": nil,
|
||||
},
|
||||
Endpoint: "foo.bar:1111",
|
||||
ResourceGroup: "armon/test",
|
||||
Token: "foobarbaz",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue