webserver mode should properly validate config

This commit is contained in:
Matthias 2023-08-17 09:15:59 +02:00
parent 7bc317fea7
commit 3bc49330ce
3 changed files with 8 additions and 2 deletions

View File

@ -7,9 +7,10 @@ def start_webserver(args: Dict[str, Any]) -> None:
""" """
Main entry point for webserver mode Main entry point for webserver mode
""" """
from freqtrade.configuration import Configuration from freqtrade.configuration import setup_utils_configuration
from freqtrade.rpc.api_server import ApiServer from freqtrade.rpc.api_server import ApiServer
# Initialize configuration # Initialize configuration
config = Configuration(args, RunMode.WEBSERVER).get_config()
config = setup_utils_configuration(args, RunMode.WEBSERVER)
ApiServer(config, standalone=True) ApiServer(config, standalone=True)

View File

@ -51,6 +51,8 @@ def validate_config_schema(conf: Dict[str, Any], preliminary: bool = False) -> D
conf_schema['required'] = constants.SCHEMA_BACKTEST_REQUIRED conf_schema['required'] = constants.SCHEMA_BACKTEST_REQUIRED
else: else:
conf_schema['required'] = constants.SCHEMA_BACKTEST_REQUIRED_FINAL conf_schema['required'] = constants.SCHEMA_BACKTEST_REQUIRED_FINAL
elif conf.get('runmode', RunMode.OTHER) == RunMode.WEBSERVER:
conf_schema['required'] = constants.SCHEMA_MINIMAL_WEBSERVER
else: else:
conf_schema['required'] = constants.SCHEMA_MINIMAL_REQUIRED conf_schema['required'] = constants.SCHEMA_MINIMAL_REQUIRED
try: try:

View File

@ -667,6 +667,9 @@ SCHEMA_MINIMAL_REQUIRED = [
'dataformat_ohlcv', 'dataformat_ohlcv',
'dataformat_trades', 'dataformat_trades',
] ]
SCHEMA_MINIMAL_WEBSERVER = SCHEMA_MINIMAL_REQUIRED + [
'api_server',
]
CANCEL_REASON = { CANCEL_REASON = {
"TIMEOUT": "cancelled due to timeout", "TIMEOUT": "cancelled due to timeout",