Pass Vault config to client
This commit is contained in:
parent
067f02a9af
commit
7d899b6c60
|
@ -118,6 +118,9 @@ type Config struct {
|
|||
// ConsulConfig is this Agent's Consul configuration
|
||||
ConsulConfig *config.ConsulConfig
|
||||
|
||||
// VaultConfig is this Agent's Vault configuration
|
||||
VaultConfig *config.VaultConfig
|
||||
|
||||
// StatsCollectionInterval is the interval at which the Nomad client
|
||||
// collects resource usage stats
|
||||
StatsCollectionInterval time.Duration
|
||||
|
@ -137,6 +140,9 @@ func (c *Config) Copy() *Config {
|
|||
nc.Node = nc.Node.Copy()
|
||||
nc.Servers = structs.CopySliceString(nc.Servers)
|
||||
nc.Options = structs.CopyMapStringString(nc.Options)
|
||||
nc.GloballyReservedPorts = structs.CopySliceInt(c.GloballyReservedPorts)
|
||||
nc.ConsulConfig = c.ConsulConfig.Copy()
|
||||
nc.VaultConfig = c.VaultConfig.Copy()
|
||||
return nc
|
||||
}
|
||||
|
||||
|
|
|
@ -352,6 +352,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
|||
}
|
||||
|
||||
conf.ConsulConfig = a.config.Consul
|
||||
conf.VaultConfig = a.config.Vault
|
||||
conf.StatsCollectionInterval = a.config.Telemetry.collectionInterval
|
||||
conf.PublishNodeMetrics = a.config.Telemetry.PublishNodeMetrics
|
||||
conf.PublishAllocationMetrics = a.config.Telemetry.PublishAllocationMetrics
|
||||
|
|
|
@ -188,3 +188,14 @@ func (c *ConsulConfig) ApiConfig() (*consul.Config, error) {
|
|||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// Copy returns a copy of this Consul config.
|
||||
func (c *ConsulConfig) Copy() *ConsulConfig {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
nc := new(ConsulConfig)
|
||||
*nc = *c
|
||||
return nc
|
||||
}
|
||||
|
|
|
@ -131,3 +131,14 @@ func (c *VaultConfig) ApiConfig(readEnv bool) (*vault.Config, error) {
|
|||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
// Copy returns a copy of this Vault config.
|
||||
func (c *VaultConfig) Copy() *VaultConfig {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
nc := new(VaultConfig)
|
||||
*nc = *c
|
||||
return nc
|
||||
}
|
||||
|
|
|
@ -204,6 +204,19 @@ func CopySliceString(s []string) []string {
|
|||
return c
|
||||
}
|
||||
|
||||
func CopySliceInt(s []int) []int {
|
||||
l := len(s)
|
||||
if l == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
c := make([]int, l)
|
||||
for i, v := range s {
|
||||
c[i] = v
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func CopySliceConstraints(s []*Constraint) []*Constraint {
|
||||
l := len(s)
|
||||
if l == 0 {
|
||||
|
|
Loading…
Reference in New Issue