mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
VAULT-17292 CE portion of changes (#24667)
* VAULT-17292 CE portion of changes * VAULT-17292 docs * VAULT-17292 changelog
This commit is contained in:
@@ -309,14 +309,25 @@ func (c *AgentCommand) Run(args []string) int {
|
||||
}
|
||||
c.metricsHelper = metricsutil.NewMetricsHelper(inmemMetrics, prometheusEnabled)
|
||||
|
||||
var templateNamespace string
|
||||
// This indicates whether the namespace for the client has been set by environment variable.
|
||||
// If it has, we don't touch it
|
||||
namespaceSetByEnvironmentVariable := client.Namespace() != ""
|
||||
|
||||
if !namespaceSetByEnvironmentVariable && config.Vault != nil && config.Vault.Namespace != "" {
|
||||
client.SetNamespace(config.Vault.Namespace)
|
||||
}
|
||||
|
||||
var method auth.AuthMethod
|
||||
var sinks []*sink.SinkConfig
|
||||
var templateNamespace string
|
||||
if config.AutoAuth != nil {
|
||||
if client.Headers().Get(consts.NamespaceHeaderName) == "" && config.AutoAuth.Method.Namespace != "" {
|
||||
// Note: This will only set namespace header to the value in config.AutoAuth.Method.Namespace
|
||||
// only if it hasn't been set by config.Vault.Namespace above. In that case, the config value
|
||||
// present at config.AutoAuth.Method.Namespace will still be used for auto-auth.
|
||||
if !namespaceSetByEnvironmentVariable && config.AutoAuth.Method.Namespace != "" {
|
||||
client.SetNamespace(config.AutoAuth.Method.Namespace)
|
||||
}
|
||||
templateNamespace = client.Headers().Get(consts.NamespaceHeaderName)
|
||||
templateNamespace = client.Namespace()
|
||||
|
||||
sinkClient, err := client.CloneWithHeaders()
|
||||
if err != nil {
|
||||
@@ -707,6 +718,11 @@ func (c *AgentCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
// Override the set namespace with the auto-auth specific namespace
|
||||
if !namespaceSetByEnvironmentVariable && config.AutoAuth.Method.Namespace != "" {
|
||||
ahClient.SetNamespace(config.AutoAuth.Method.Namespace)
|
||||
}
|
||||
|
||||
if config.DisableIdleConnsAutoAuth {
|
||||
ahClient.SetMaxIdleConnections(-1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user