Skip to content

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 <[email protected]>
  • Loading branch information
katrogan authored Aug 9, 2022
1 parent c2d8de8 commit 7da6209
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flyteidl/clients/go/admin/token_source_provider.go
Original file line number Diff line number Diff line change
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 7da6209

Please sign in to comment.