Updates to allow for using an enterprise specific token as the agents token

This is needed to allow for managed Consul instances to register themselves in the catalog with one of the managed service provider tokens.
This commit is contained in:
Matt Keeler 2020-04-28 09:44:26 -04:00
parent 901d6739ad
commit fbb5c28c80
No known key found for this signature in database
GPG Key ID: 04DBAE1857E0081B
3 changed files with 10 additions and 1 deletions

View File

@ -1412,7 +1412,7 @@ func (a *Agent) consulConfig() (*consul.Config, error) {
} }
base.ConfigEntryBootstrap = a.config.ConfigEntryBootstrap base.ConfigEntryBootstrap = a.config.ConfigEntryBootstrap
return a.enterpriseConsulConfig(base) return a.enterpriseConsulConfig(base)
} }

View File

@ -113,6 +113,10 @@ func (t *Store) AgentToken() string {
t.l.RLock() t.l.RLock()
defer t.l.RUnlock() defer t.l.RUnlock()
if tok := t.enterpriseAgentToken(); tok != "" {
return tok
}
if t.agentToken != "" { if t.agentToken != "" {
return t.agentToken return t.agentToken
} }

View File

@ -5,3 +5,8 @@ package token
// Stub for enterpriseTokens // Stub for enterpriseTokens
type enterpriseTokens struct { type enterpriseTokens struct {
} }
// enterpriseAgentToken OSS stub
func (s *Store) enterpriseAgentToken() string {
return ""
}