mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add --show-sensitive CLI option
This commit is contained in:
parent
6b7935f1ae
commit
81d1a662a2
|
@ -62,7 +62,7 @@ ARGS_TEST_PAIRLIST = ["user_data_dir", "verbosity", "config", "quote_currencies"
|
|||
ARGS_CREATE_USERDIR = ["user_data_dir", "reset"]
|
||||
|
||||
ARGS_BUILD_CONFIG = ["config"]
|
||||
ARGS_SHOW_CONFIG = ["user_data_dir", "config"]
|
||||
ARGS_SHOW_CONFIG = ["user_data_dir", "config", "show_sensitive"]
|
||||
|
||||
ARGS_BUILD_STRATEGY = ["user_data_dir", "strategy", "template"]
|
||||
|
||||
|
|
|
@ -276,8 +276,10 @@ def start_show_config(args: Dict[str, Any]) -> None:
|
|||
# TODO: Sanitize from sensitive info before printing
|
||||
|
||||
print("Your combined configuration is:")
|
||||
|
||||
config_sanitized = sanitize_config(config['original_config'])
|
||||
config_sanitized = sanitize_config(
|
||||
config['original_config'],
|
||||
show_sensitive=args.get('show_sensitive', False)
|
||||
)
|
||||
|
||||
from rich import print_json
|
||||
print_json(data=config_sanitized)
|
||||
|
|
|
@ -716,4 +716,10 @@ AVAILABLE_CLI_OPTIONS = {
|
|||
help='Specify startup candles to be checked (`199`, `499`, `999`, `1999`).',
|
||||
nargs='+',
|
||||
),
|
||||
"show_sensitive": Arg(
|
||||
'--show-sensitive',
|
||||
help='Show secrets in the output.',
|
||||
action='store_true',
|
||||
default=False,
|
||||
),
|
||||
}
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
from freqtrade.constants import Config
|
||||
|
||||
|
||||
def sanitize_config(config: Config) -> 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 = [
|
||||
"exchange.key",
|
||||
"exchange.secret",
|
||||
|
|
Loading…
Reference in New Issue
Block a user