diff --git a/actions.go b/actions.go index 09cfe50..c74cebe 100644 --- a/actions.go +++ b/actions.go @@ -406,6 +406,12 @@ func (c *Action) GetIDToken(ctx context.Context, audience string) (string, error return tokenResp.Value, nil } +// Getenv retrieves the value of the environment variable named by the key. +// It uses an internal function that can be set with `WithGetenv`. +func (c *Action) Getenv(key string) string { + return c.getenv(key) +} + // GetenvFunc is an abstraction to make tests feasible for commands that // interact with environment variables. -type GetenvFunc func(k string) string +type GetenvFunc func(key string) string diff --git a/options.go b/options.go index 6a6013f..55727aa 100644 --- a/options.go +++ b/options.go @@ -19,7 +19,7 @@ import ( "net/http" ) -// Option is a modifier for an Action +// Option is a modifier for an Action. type Option func(*Action) *Action // WithWriter sets the writer function on an Action. By default, this will diff --git a/options_test.go b/options_test.go index 1c36376..dafaaf6 100644 --- a/options_test.go +++ b/options_test.go @@ -65,7 +65,7 @@ func TestWithGetenv(t *testing.T) { }) opt(a) - if got, want := a.getenv("any"), "sentinel"; got != want { + if got, want := a.Getenv("any"), "sentinel"; got != want { t.Errorf("expected %q to be %q", got, want) } }