First wave of review updates.

Change-Id: Ibfe8cb23f12c516d9264fcbbee8d8af64b458c89
This commit is contained in:
Patrick Jones
2021-01-13 12:20:07 -08:00
parent 3454980053
commit 82dc24d404
4 changed files with 13 additions and 18 deletions

View File

@@ -66,11 +66,11 @@ type CredentialSource struct {
}
// parse determines the type of CredentialSource needed
func (c *Config) parse() baseCredentialSource {
func (c *Config) parse(ctx context.Context) baseCredentialSource {
if c.CredentialSource.File != "" {
return fileCredentialSource{File: c.CredentialSource.File, Format: c.CredentialSource.Format}
} else if c.CredentialSource.URL != "" {
return urlCredentialSource{URL: c.CredentialSource.URL, Format: c.CredentialSource.Format}
return urlCredentialSource{URL: c.CredentialSource.URL, Format: c.CredentialSource.Format, ctx: ctx}
}
return nil
}
@@ -89,7 +89,7 @@ type tokenSource struct {
func (ts tokenSource) Token() (*oauth2.Token, error) {
conf := ts.conf
credSource := conf.parse()
credSource := conf.parse(ts.ctx)
if credSource == nil {
return nil, fmt.Errorf("oauth2/google: unable to parse credential source")
}