chore: minor refactor of config cleanup
This commit is contained in:
@@ -3,16 +3,7 @@ from copy import deepcopy
|
||||
from freqtrade.constants import Config
|
||||
|
||||
|
||||
def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
|
||||
"""
|
||||
Remove sensitive information from the config.
|
||||
:param config: Configuration
|
||||
:param show_sensitive: Show sensitive information
|
||||
:return: Configuration
|
||||
"""
|
||||
if show_sensitive:
|
||||
return config
|
||||
keys_to_remove = [
|
||||
_SENSITIVE_KEYS = [
|
||||
"exchange.key",
|
||||
"exchange.api_key",
|
||||
"exchange.apiKey",
|
||||
@@ -31,8 +22,19 @@ def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
|
||||
"api_server.password",
|
||||
"webhook.url",
|
||||
]
|
||||
|
||||
|
||||
def sanitize_config(config: Config, *, show_sensitive: bool = False) -> Config:
|
||||
"""
|
||||
Remove sensitive information from the config.
|
||||
:param config: Configuration
|
||||
:param show_sensitive: Show sensitive information
|
||||
:return: Configuration
|
||||
"""
|
||||
if show_sensitive:
|
||||
return config
|
||||
config = deepcopy(config)
|
||||
for key in keys_to_remove:
|
||||
for key in _SENSITIVE_KEYS:
|
||||
if "." in key:
|
||||
nested_keys = key.split(".")
|
||||
nested_config = config
|
||||
|
||||
Reference in New Issue
Block a user