-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also added the possibility for the provider to ignore environment variables if requested. This makes it possible to test scenarios where the various configuration options are not set, even if environment variables have to be set for the rest of the test suite.
- Loading branch information
Showing
5 changed files
with
123 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package provider | ||
|
||
type Options struct { | ||
UseCredentialsFromEnvironment bool | ||
} | ||
|
||
func DefaultOptions() *Options { | ||
return &Options{ | ||
UseCredentialsFromEnvironment: true, | ||
} | ||
} | ||
|
||
type Option interface { | ||
Apply(opts *Options) | ||
} | ||
|
||
type OptionFunc func(opts *Options) | ||
|
||
func (f OptionFunc) Apply(opts *Options) { | ||
f(opts) | ||
} | ||
|
||
func WithUseCredentialsFromEnvironment(enabled bool) Option { | ||
return OptionFunc(func(opts *Options) { | ||
opts.UseCredentialsFromEnvironment = enabled | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters