7 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
10const multipleValuesForSecretSource = "multiple values specified for secret source: specify either value, fromEnv of fromFile"
12func validateSecretSource(source options.SecretSource) string {
14 case len(source.Value) > 0 && source.FromEnv == "" && source.FromFile == "":
16 case len(source.Value) == 0 && source.FromEnv != "" && source.FromFile == "":
17 return validateSecretSourceEnv(source.FromEnv)
18 case len(source.Value) == 0 && source.FromEnv == "" && source.FromFile != "":
19 return validateSecretSourceFile(source.FromFile)
21 return multipleValuesForSecretSource
25func validateSecretSourceEnv(key string) string {
26 if value := os.Getenv(key); value == "" {
27 return fmt.Sprintf("error loading secret from environent: no value for for key %q", key)
32func validateSecretSourceFile(path string) string {
33 if _, err := os.Stat(path); err != nil {
34 return fmt.Sprintf("error loadig secret from file: %v", err)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list