forked from remote/oauth2
Changes requested by @codyoss
This commit is contained in:
@@ -214,7 +214,7 @@ func (c *Config) parse(ctx context.Context) (baseCredentialSource, error) {
|
||||
} else if c.CredentialSource.URL != "" {
|
||||
return urlCredentialSource{URL: c.CredentialSource.URL, Headers: c.CredentialSource.Headers, Format: c.CredentialSource.Format, ctx: ctx}, nil
|
||||
} else if c.CredentialSource.Executable != nil {
|
||||
return CreateExecutableCredential(*c.CredentialSource.Executable, c, ctx), nil
|
||||
return CreateExecutableCredential(ctx, c.CredentialSource.Executable, c), nil
|
||||
}
|
||||
return nil, fmt.Errorf("oauth2/google: unable to parse credential source")
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ type executableCredentialSource struct {
|
||||
|
||||
// CreateExecutableCredential creates an executableCredentialSource given an ExecutableConfig.
|
||||
// It also performs defaulting and type conversions.
|
||||
func CreateExecutableCredential(ec ExecutableConfig, config *Config, ctx context.Context) (result executableCredentialSource) {
|
||||
func CreateExecutableCredential(ctx context.Context, ec *ExecutableConfig, config *Config) (result executableCredentialSource) {
|
||||
result.Command = ec.Command
|
||||
if ec.TimeoutMillis == 0 {
|
||||
result.Timeout = defaultTimeout
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestCreateExecutableCredential(t *testing.T) {
|
||||
TimeoutMillis: 50000,
|
||||
}
|
||||
|
||||
ecs := CreateExecutableCredential(ec, nil, context.Background())
|
||||
ecs := CreateExecutableCredential(context.Background(), &ec, nil)
|
||||
if ecs.Command != "blarg" {
|
||||
t.Errorf("ecs.Command got %v but want %v", ecs.Command, "blarg")
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func TestCreateExecutableCredential_WithoutTimeout(t *testing.T) {
|
||||
Command: "blarg",
|
||||
}
|
||||
|
||||
ecs := CreateExecutableCredential(ec, nil, context.Background())
|
||||
ecs := CreateExecutableCredential(context.Background(), &ec, nil)
|
||||
if ecs.Command != "blarg" {
|
||||
t.Errorf("ecs.Command got %v but want %v", ecs.Command, "blarg")
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func TestMinimalExecutableCredentialGetEnvironment(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
ecs := CreateExecutableCredential(*config.CredentialSource.Executable, &config, context.Background())
|
||||
ecs := CreateExecutableCredential(context.Background(), config.CredentialSource.Executable, &config)
|
||||
|
||||
oldBaseEnv := baseEnv
|
||||
defer func() { baseEnv = oldBaseEnv }()
|
||||
@@ -122,7 +122,7 @@ func TestExectuableCredentialGetEnvironmentMalformedImpersonationUrl(t *testing.
|
||||
},
|
||||
}
|
||||
|
||||
ecs := CreateExecutableCredential(*config.CredentialSource.Executable, &config, context.Background())
|
||||
ecs := CreateExecutableCredential(context.Background(), config.CredentialSource.Executable, &config)
|
||||
|
||||
oldBaseEnv := baseEnv
|
||||
defer func() { baseEnv = oldBaseEnv }()
|
||||
@@ -157,7 +157,7 @@ func TestExectuableCredentialGetEnvironment(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
ecs := CreateExecutableCredential(*config.CredentialSource.Executable, &config, context.Background())
|
||||
ecs := CreateExecutableCredential(context.Background(), config.CredentialSource.Executable, &config)
|
||||
|
||||
oldBaseEnv := baseEnv
|
||||
defer func() { baseEnv = oldBaseEnv }()
|
||||
|
||||
Reference in New Issue
Block a user