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:
dekun
2026-07-17 19:24:10 +08:00
parent b7966fd935
commit 4d381e9104
12 changed files with 111 additions and 15 deletions
@@ -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,
+1 -1
View File
@@ -115,7 +115,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
<script>
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
</script>
<script src="/static/instance_settings_prefs.js?v=16"></script>
<script src="/static/instance_settings_prefs.js?v=17"></script>
<script src="/static/instance_live.js?v=6"></script>
<script src="/static/instance_embed.js?v=25"></script>
</body>
+1 -1
View File
@@ -2020,6 +2020,6 @@ document.addEventListener("DOMContentLoaded", function () {
});
{% endif %}
</script>
<script src="/static/instance_settings_prefs.js?v=16"></script>
<script src="/static/instance_settings_prefs.js?v=17"></script>
</body>
</html>