Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Read client secret from env var first since the location has a default (
Browse files Browse the repository at this point in the history
#312)

Signed-off-by: Katrina Rogan <katroganGH@gmail.com>
  • Loading branch information
katrogan committed Aug 9, 2022
1 parent dbeb016 commit 0b20c5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clients/go/admin/token_source_provider.go
Expand Up @@ -136,15 +136,15 @@ type ClientCredentialsTokenSourceProvider struct {
func NewClientCredentialsTokenSourceProvider(ctx context.Context, cfg *Config,
clientMetadata *service.PublicClientAuthConfigResponse, tokenURL string) (TokenSourceProvider, error) {
var secret string
if len(cfg.ClientSecretLocation) > 0 {
if len(cfg.ClientSecretEnvVar) > 0 {
secret = os.Getenv(cfg.ClientSecretEnvVar)
} else if len(cfg.ClientSecretLocation) > 0 {
secretBytes, err := ioutil.ReadFile(cfg.ClientSecretLocation)
if err != nil {
logger.Errorf(ctx, "Error reading secret from location %s", cfg.ClientSecretLocation)
return nil, err
}
secret = string(secretBytes)
} else if len(cfg.ClientSecretEnvVar) > 0 {
secret = os.Getenv(cfg.ClientSecretEnvVar)
}
secret = strings.TrimSpace(secret)

Expand Down

0 comments on commit 0b20c5c

Please sign in to comment.