Skip to content

Commit

Permalink
local: default to the agent token instead of the user token
Browse files Browse the repository at this point in the history
When de-registering in anti-entropy sync, when there is no service or
check token.

The agent token will fall back to the default (aka user) token if no agent
token is set, so the existing behaviour still works, but it will prefer
the agent token over the user token if both are set.

ref: https://www.consul.io/docs/agent/options#acl_tokens

The agent token seems more approrpiate in this case, since this is an
"internal operation", not something initiated by the user.
  • Loading branch information
dnephin committed Feb 1, 2021
1 parent f4dcb09 commit 6621e40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/local/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (l *State) serviceToken(id structs.ServiceID) string {
token = s.Token
}
if token == "" {
token = l.tokens.UserToken()
token = l.tokens.AgentToken()
}
return token
}
Expand Down Expand Up @@ -457,7 +457,7 @@ func (l *State) checkToken(id structs.CheckID) string {
token = c.Token
}
if token == "" {
token = l.tokens.UserToken()
token = l.tokens.AgentToken()
}
return token
}
Expand Down

0 comments on commit 6621e40

Please sign in to comment.