Module config_watcher_fs

Module config_watcher_fs 

Source
Expand description

Filesystem watcher for settings.json — detects saves and pushes updated config to all connected WebSocket clients in real time.

Functions§

load_settings_from_disk
Load settings.json from disk into the ConfigWatcher. Called once at startup so the backend has the user’s saved settings.
merge_settings_into_current
Merge new keys into the current in-memory SettingsType and return the result. Used by the setconfig handler to update in-memory state before the fs watcher fires.
merge_settings_to_disk
Merge a flat map of settings keys into settings.json on disk. Existing keys not present in new_keys are preserved. The fs watcher will detect the write (~300ms) and broadcast the updated config.
reload_and_broadcast 🔒
resolve_settings_dir
Resolve the directory containing settings.json.
spawn_settings_watcher
Spawn a filesystem watcher that monitors settings.json and broadcasts config updates to all WebSocket clients on change.