mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Merge pull request #1655 from hashicorp/cluster-id
Vault cluster name and ID
This commit is contained in:
@@ -33,6 +33,8 @@ type Config struct {
|
||||
MaxLeaseTTLRaw string `hcl:"max_lease_ttl"`
|
||||
DefaultLeaseTTL time.Duration `hcl:"-"`
|
||||
DefaultLeaseTTLRaw string `hcl:"default_lease_ttl"`
|
||||
|
||||
ClusterName string `hcl:"cluster_name"`
|
||||
}
|
||||
|
||||
// DevConfig is a Config that is used for dev mode of Vault.
|
||||
@@ -210,6 +212,11 @@ func (c *Config) Merge(c2 *Config) *Config {
|
||||
result.DefaultLeaseTTL = c2.DefaultLeaseTTL
|
||||
}
|
||||
|
||||
result.ClusterName = c.ClusterName
|
||||
if c2.ClusterName != "" {
|
||||
result.ClusterName = c2.ClusterName
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -277,6 +284,7 @@ func ParseConfig(d string) (*Config, error) {
|
||||
"telemetry",
|
||||
"default_lease_ttl",
|
||||
"max_lease_ttl",
|
||||
"cluster_name",
|
||||
|
||||
// TODO: Remove in 0.6.0
|
||||
// Deprecated keys
|
||||
|
||||
@@ -61,6 +61,7 @@ func TestLoadConfigFile(t *testing.T) {
|
||||
MaxLeaseTTLRaw: "10h",
|
||||
DefaultLeaseTTL: 10 * time.Hour,
|
||||
DefaultLeaseTTLRaw: "10h",
|
||||
ClusterName: "testcluster",
|
||||
}
|
||||
if !reflect.DeepEqual(config, expected) {
|
||||
t.Fatalf("expected \n\n%#v\n\n to be \n\n%#v\n\n", config, expected)
|
||||
@@ -120,6 +121,7 @@ func TestLoadConfigFile_json(t *testing.T) {
|
||||
MaxLeaseTTLRaw: "10h",
|
||||
DefaultLeaseTTL: 10 * time.Hour,
|
||||
DefaultLeaseTTLRaw: "10h",
|
||||
ClusterName: "testcluster",
|
||||
}
|
||||
if !reflect.DeepEqual(config, expected) {
|
||||
t.Fatalf("expected \n\n%#v\n\n to be \n\n%#v\n\n", config, expected)
|
||||
@@ -218,6 +220,7 @@ func TestLoadConfigDir(t *testing.T) {
|
||||
|
||||
MaxLeaseTTL: 10 * time.Hour,
|
||||
DefaultLeaseTTL: 10 * time.Hour,
|
||||
ClusterName: "testcluster",
|
||||
}
|
||||
if !reflect.DeepEqual(config, expected) {
|
||||
t.Fatalf("bad: %#v", config)
|
||||
|
||||
@@ -5,3 +5,4 @@ telemetry {
|
||||
}
|
||||
|
||||
default_lease_ttl = "10h"
|
||||
cluster_name = "testcluster"
|
||||
|
||||
@@ -26,3 +26,4 @@ ha_backend "consul" {
|
||||
|
||||
max_lease_ttl = "10h"
|
||||
default_lease_ttl = "10h"
|
||||
cluster_name = "testcluster"
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
"statsite_address": "baz"
|
||||
},
|
||||
"max_lease_ttl": "10h",
|
||||
"default_lease_ttl": "10h"
|
||||
"default_lease_ttl": "10h",
|
||||
"cluster_name":"testcluster"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user