Add ws_token to auto-generated config

This commit is contained in:
Matthias 2022-09-09 07:13:05 +02:00
parent 46cd0ce994
commit e256ebd727
4 changed files with 4 additions and 3 deletions

View File

@ -211,6 +211,7 @@ def ask_user_config() -> Dict[str, Any]:
)
# Force JWT token to be a random string
answers['api_server_jwt_key'] = secrets.token_hex()
answers['api_server_ws_token'] = secrets.token_urlsafe(25)
return answers

View File

@ -1,7 +1,6 @@
from enum import Enum
# We need to inherit from str so we can use as a str
class RPCMessageType(str, Enum):
STATUS = 'status'
WARNING = 'warning'

View File

@ -1086,7 +1086,7 @@ class RPC:
""" Whitelist data for WebSocket """
return self._freqtrade.active_pair_whitelist
@ staticmethod
@staticmethod
def _rpc_analysed_history_full(config, pair: str, timeframe: str,
timerange: str, exchange) -> Dict[str, Any]:
timerange_parsed = TimeRange.parse_timerange(timerange)
@ -1117,7 +1117,7 @@ class RPC:
self._freqtrade.strategy.plot_config['subplots'] = {}
return self._freqtrade.strategy.plot_config
@ staticmethod
@staticmethod
def _rpc_sysinfo() -> Dict[str, Any]:
return {
"cpu_pct": psutil.cpu_percent(interval=1, percpu=True),

View File

@ -67,6 +67,7 @@
"verbosity": "error",
"enable_openapi": false,
"jwt_secret_key": "{{ api_server_jwt_key }}",
"ws_token": "{{ api_server_ws_token }}",
"CORS_origins": [],
"username": "{{ api_server_username }}",
"password": "{{ api_server_password }}"