fix: wrong if condition, improve error message.

This commit is contained in:
Guillaume Blaquiere 2021-09-27 21:47:14 +02:00
parent 5f31cd7a34
commit 742a68cda0
1 changed files with 2 additions and 2 deletions

View File

@ -186,8 +186,8 @@ func (f *credentialsFile) tokenSource(ctx context.Context, params CredentialsPar
}
return cfg.TokenSource(ctx)
case impersonatedServiceAccount:
if f.ServiceAccountImpersonationURL != "" && f.SourceCredentials == nil {
return nil, errors.New("missing 'source_credentials' field in credentials")
if f.ServiceAccountImpersonationURL != "" || f.SourceCredentials == nil {
return nil, errors.New("missing 'source_credentials' field or 'service_account_impersonation_url' in credentials")
}
ts, err := f.SourceCredentials.tokenSource(ctx, params)