fix: clean up oauthCredentials after migration
- Remove oauthCredentials dict after extracting api_key to avoid duplication - Use _ for unused provider_name variable per convention Addresses review feedback from PR #32.
This commit is contained in:
@@ -95,7 +95,7 @@ def _migrate_config(data: dict) -> dict:
|
||||
|
||||
# Extract api_key from oauthCredentials if present
|
||||
providers = data.get("providers", {})
|
||||
for provider_name, provider_config in providers.items():
|
||||
for _, provider_config in providers.items():
|
||||
if isinstance(provider_config, dict):
|
||||
oauth_creds = provider_config.get("oauthCredentials")
|
||||
if oauth_creds and isinstance(oauth_creds, dict):
|
||||
@@ -103,5 +103,7 @@ def _migrate_config(data: dict) -> dict:
|
||||
# Only set api_key if not already set and access_token exists
|
||||
if access_token and not provider_config.get("api_key"):
|
||||
provider_config["api_key"] = access_token
|
||||
# Clean up migrated data to avoid duplication
|
||||
del provider_config["oauthCredentials"]
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user