Skip to content

Commit 5aaf3d2

Browse files
committed
refac: Move special handling of global override to only make it relevant for known domains
1 parent d5f9d9f commit 5aaf3d2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/anaconda_auth/_conda/auth_handler.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ def _load_token_domain(self, parsed_url: ParseResult) -> tuple[str, CredentialTy
5959
if channel_domain in TOKEN_DOMAIN_MAP:
6060
token_domain, credential_type = TOKEN_DOMAIN_MAP[channel_domain]
6161

62-
# Allow users to override default via configuration
63-
config = AnacondaAuthConfig(domain=token_domain)
64-
if config.use_unified_repo_api_key:
65-
credential_type = CredentialType.API_KEY
62+
# Respect the global configuration override to force API key
63+
# This is relevant for channels who are configured by default to
64+
# use repo tokens, but not available unless for a specific domain
65+
# like repo.anaconda.cloud.
66+
config = AnacondaAuthConfig(domain=token_domain)
67+
if config.use_unified_repo_api_key:
68+
credential_type = CredentialType.API_KEY
6669

6770
return token_domain, credential_type
6871

0 commit comments

Comments
 (0)