chore: support snake_case for api keys

This commit is contained in:
Matthias
2024-08-02 07:05:45 +02:00
parent 4542157192
commit dd55baf148
2 changed files with 12 additions and 4 deletions

View File

@@ -14,12 +14,16 @@ def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
return config return config
keys_to_remove = [ keys_to_remove = [
"exchange.key", "exchange.key",
"exchange.api_key",
"exchange.apiKey", "exchange.apiKey",
"exchange.secret", "exchange.secret",
"exchange.password", "exchange.password",
"exchange.uid", "exchange.uid",
"exchange.account_id",
"exchange.accountId", "exchange.accountId",
"exchange.wallet_address",
"exchange.walletAddress", "exchange.walletAddress",
"exchange.private_key",
"exchange.privateKey", "exchange.privateKey",
"telegram.token", "telegram.token",
"telegram.chat_id", "telegram.chat_id",

View File

@@ -353,14 +353,18 @@ class Exchange:
raise OperationalException(f"Exchange {name} is not supported by ccxt") raise OperationalException(f"Exchange {name} is not supported by ccxt")
ex_config = { ex_config = {
"apiKey": exchange_config.get("apiKey", exchange_config.get("key")), "apiKey": exchange_config.get(
"api_key", exchange_config.get("apiKey", exchange_config.get("key"))
),
"secret": exchange_config.get("secret"), "secret": exchange_config.get("secret"),
"password": exchange_config.get("password"), "password": exchange_config.get("password"),
"uid": exchange_config.get("uid", ""), "uid": exchange_config.get("uid", ""),
"accountId": exchange_config.get("accountId", ""), "accountId": exchange_config.get("account_id", exchange_config.get("accountId", "")),
# DEX attributes: # DEX attributes:
"walletAddress": exchange_config.get("walletAddress"), "walletAddress": exchange_config.get(
"privateKey": exchange_config.get("privateKey"), "wallet_address", exchange_config.get("walletAddress")
),
"privateKey": exchange_config.get("private_key", exchange_config.get("privateKey")),
} }
if ccxt_kwargs: if ccxt_kwargs:
logger.info("Applying additional ccxt config: %s", ccxt_kwargs) logger.info("Applying additional ccxt config: %s", ccxt_kwargs)