diff options
| author | Michelle Tilley <michelle@michelletilley.net> | 2026-03-05 08:36:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 17:36:31 +0100 |
| commit | e6ab243dfde79c50ce5661b630ed26b9a1504dae (patch) | |
| tree | a8bd99d3a22f6592d91fad7766574310e7fc1dbc /crates/atuin-daemon/src/lib.rs | |
| parent | feat: initial draft of atuin-shell (#3206) (diff) | |
| download | atuin-e6ab243dfde79c50ce5661b630ed26b9a1504dae.zip | |
feat: Allow setting multipliers for frequency, recency, and frecency scores (#3235)
Diffstat (limited to 'crates/atuin-daemon/src/lib.rs')
| -rw-r--r-- | crates/atuin-daemon/src/lib.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/crates/atuin-daemon/src/lib.rs b/crates/atuin-daemon/src/lib.rs index 6dc04db3..84f808e4 100644 --- a/crates/atuin-daemon/src/lib.rs +++ b/crates/atuin-daemon/src/lib.rs @@ -1,5 +1,6 @@ use atuin_client::database::Sqlite as HistoryDatabase; -use atuin_client::{record::sqlite_store::SqliteStore, settings::Settings}; +use atuin_client::record::sqlite_store::SqliteStore; +use atuin_client::settings::{Settings, watcher::global_settings_watcher}; use eyre::Result; pub mod client; @@ -59,6 +60,26 @@ pub async fn boot( // Start all components first (so gRPC services can work) daemon.start_components().await?; + // Spawn config file watcher to reload settings on changes + if let Ok(watcher) = global_settings_watcher() { + let mut settings_rx = watcher.subscribe(); + let watcher_handle = handle.clone(); + tokio::spawn(async move { + tracing::info!("config file watcher started"); + while settings_rx.changed().await.is_ok() { + // Use the already-loaded settings from the watcher + // (avoids parsing the config file twice) + let new_settings = (*settings_rx.borrow()).clone(); + watcher_handle.apply_settings((*new_settings).clone()).await; + } + tracing::debug!("config file watcher stopped"); + }); + } else { + tracing::warn!( + "failed to start config file watcher; settings changes will require daemon restart" + ); + } + // Spawn signal handler to emit ShutdownRequested on Ctrl+C/SIGTERM let signal_handle = handle.clone(); tokio::spawn(async move { |
