@@ -22,7 +22,6 @@ import (
22
22
"github.com/snyk/container-cli/pkg/container"
23
23
"github.com/snyk/go-application-framework/pkg/analytics"
24
24
"github.com/snyk/go-application-framework/pkg/app"
25
- "github.com/snyk/go-application-framework/pkg/auth"
26
25
"github.com/snyk/go-application-framework/pkg/configuration"
27
26
"github.com/snyk/go-application-framework/pkg/instrumentation"
28
27
"github.com/spf13/cobra"
@@ -92,25 +91,6 @@ func initApplicationConfiguration(config configuration.Configuration) {
92
91
config .AddAlternativeKeys (configuration .ORGANIZATION , []string {"snyk_cfg_org" })
93
92
config .AddAlternativeKeys (configuration .PREVIEW_FEATURES_ENABLED , []string {"snyk_preview" })
94
93
config .AddAlternativeKeys (configuration .LOG_LEVEL , []string {debug_level_flag })
95
-
96
- // if the CONFIG_KEY_OAUTH_TOKEN is specified as env var, we don't apply any additional logic
97
- _ , ok := os .LookupEnv (auth .CONFIG_KEY_OAUTH_TOKEN )
98
- if ! ok {
99
- alternativeBearerKeys := config .GetAlternativeKeys (configuration .AUTHENTICATION_BEARER_TOKEN )
100
- alternativeBearerKeys = append (alternativeBearerKeys , configuration .AUTHENTICATION_BEARER_TOKEN )
101
- for _ , key := range alternativeBearerKeys {
102
- hasPrefix := strings .HasPrefix (key , "snyk_" )
103
- if hasPrefix {
104
- formattedKey := strings .ToUpper (key )
105
- _ , ok := os .LookupEnv (formattedKey )
106
- if ok {
107
- globalLogger .Printf ("Found environment variable %s, disabling OAuth flow" , formattedKey )
108
- config .Set (configuration .FF_OAUTH_AUTH_FLOW_ENABLED , false )
109
- break
110
- }
111
- }
112
- }
113
- }
114
94
}
115
95
116
96
func getFullCommandString (cmd * cobra.Command ) string {
@@ -480,6 +460,8 @@ func MainWithErrorCode() int {
480
460
481
461
globalEngine = app .CreateAppEngineWithOptions (app .WithZeroLogger (globalLogger ), app .WithConfiguration (globalConfiguration ), app .WithRuntimeInfo (rInfo ))
482
462
463
+ globalConfiguration .AddDefaultValue (configuration .FF_OAUTH_AUTH_FLOW_ENABLED , defaultOAuthFF (globalConfiguration ))
464
+
483
465
if noProxyAuth := globalConfiguration .GetBool (basic_workflows .PROXY_NOAUTH ); noProxyAuth {
484
466
globalConfiguration .Set (configuration .PROXY_AUTHENTICATION_MECHANISM , httpauth .StringFromAuthenticationMechanism (httpauth .NoAuth ))
485
467
}
0 commit comments