diff --git a/pkg/cmdutil/factory.go b/pkg/cmdutil/factory.go index 6ce417a..cf8a674 100644 --- a/pkg/cmdutil/factory.go +++ b/pkg/cmdutil/factory.go @@ -10,17 +10,6 @@ import ( "strings" ) -// SubdomainToEnvironmentMap is a map of subdomains to environments -var SubdomainToEnvironmentMap = map[string]string{ - "test": "test", - "dev": "test", - "awsd": "test", - "azd": "test", - "production": "production", - "awsp": "production", - "azp": "production", -} - const boxerURL = "https://boxer.%s.sneaksanddata.com" // AuthServiceFactory is responsible for creating instances of AuthService. @@ -52,10 +41,6 @@ func (f *AuthServiceFactory) CreateAuthService(env, provider string) (*auth.Serv // InitializeAuthService initializes the AuthService based on a URL and an AuthProvider. // It checks the URL for a known subdomain to determine the environment. func InitializeAuthService(url, env, authProvider string, authServiceFactory AuthServiceFactory) (*auth.Service, error) { - matchedUrl, matchedEnv := containsSubdomain(url, SubdomainToEnvironmentMap) - if matchedUrl != "" { - env = matchedEnv - } return authServiceFactory.CreateAuthService(env, authProvider) } @@ -165,16 +150,6 @@ func processURL(url, env string) string { return url } -// containsSubdomain checks if the given URL contains any subdomain as defined in the subdomainMap. -func containsSubdomain(url string, subdomainMap map[string]string) (string, string) { - for key, value := range subdomainMap { - if strings.Contains(url, key) { - return url, value // Found a match, return the url and environment - } - } - return "", "" // No match found -} - // createTokenProvider initializes a token.Provider with the given environment and AuthService. func createTokenProvider(env string, authService token.AuthService) (*token.Provider, error) { tp, err := token.NewProvider(authService, env)