Skip to content

Commit

Permalink
don't fetch missing org tokens when tokens came from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
btoews committed Nov 12, 2024
1 parent d8752b2 commit f90145f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/config/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func MonitorTokens(monitorCtx context.Context, t *tokens.Tokens, uucb UserURLCal
log.Debugf("failed to update discharge tokens: %s", err)
}

if file != "" && updated1 || updated2 {
if file != "" && (updated1 || updated2) {
if err := SetAccessToken(file, t.All()); err != nil {
log.Debugf("failed to persist updated tokens: %s", err)
}
Expand Down Expand Up @@ -198,6 +198,11 @@ func refreshDischargeTokens(ctx context.Context, t *tokens.Tokens, uucb UserURLC
//
// Don't call this when other goroutines might also be accessing t.
func fetchOrgTokens(ctx context.Context, t *tokens.Tokens) (bool, error) {
// don't fetch missing org tokens if tokens came from environment var
if t.FromFile() == "" {
return false, nil
}

return doFetchOrgTokens(ctx, t, defaultOrgFetcher, defaultTokenMinter)
}

Expand Down

0 comments on commit f90145f

Please sign in to comment.