fix: hot-reload trade direction/whitelist on env save without forced restart.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,6 +60,7 @@ def register_instance_settings_routes(
|
||||
exchange_key: str,
|
||||
username: str,
|
||||
password: str,
|
||||
on_env_changed: Callable[[list[str]], None] | None = None,
|
||||
) -> None:
|
||||
env_path = os.path.join(base_dir, ".env")
|
||||
example_path = os.path.join(base_dir, ".env.example")
|
||||
@@ -107,6 +108,11 @@ def register_instance_settings_routes(
|
||||
changed = apply_env_updates(env_path, clean)
|
||||
groups = parse_env_example_schema(example_path)
|
||||
reload_info = apply_env_reload(env_path, get_db, changed, groups)
|
||||
if changed and callable(on_env_changed):
|
||||
try:
|
||||
on_env_changed(changed)
|
||||
except Exception as e:
|
||||
print(f"[instance_settings] on_env_changed: {e}", flush=True)
|
||||
return jsonify(
|
||||
{
|
||||
"ok": True,
|
||||
|
||||
Reference in New Issue
Block a user