diff options
| author | Nemo157 <git@nemo157.com> | 2024-05-25 14:03:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-25 13:03:55 +0100 |
| commit | 2e88321aecfd1c4a7fa69a1794ecdf34a401c358 (patch) | |
| tree | 8301dc4832325a4700409aaa8a86cefb5d824437 /crates/atuin-client | |
| parent | perf: only open the database for commands if strictly required (#2043) (diff) | |
| download | atuin-2e88321aecfd1c4a7fa69a1794ecdf34a401c358.zip | |
feat: support systemd socket activation for daemon (#2039)
This avoids issues with clients attempting to connect to the daemon
while it's starting, systemd creates the socket early and will queue
connections up until the daemon is ready to accept them.
Diffstat (limited to 'crates/atuin-client')
| -rw-r--r-- | crates/atuin-client/config.toml | 5 | ||||
| -rw-r--r-- | crates/atuin-client/src/settings.rs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/atuin-client/config.toml b/crates/atuin-client/config.toml index 49e06c45..4938991a 100644 --- a/crates/atuin-client/config.toml +++ b/crates/atuin-client/config.toml @@ -223,5 +223,10 @@ records = true ## windows: Not Supported # socket_path = "~/.local/share/atuin/atuin.sock" +## Use systemd socket activation rather than opening the given path (the path must still be correct for the client) +## linux: false +## mac/windows: Not Supported +# systemd_socket = false + ## The port that should be used for TCP on non unix systems # tcp_port = 8889 diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index a97d05eb..f4434e41 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -350,6 +350,9 @@ pub struct Daemon { /// The path to the unix socket used by the daemon pub socket_path: String, + /// Use a socket passed via systemd's socket activation protocol, instead of the path + pub systemd_socket: bool, + /// The port that should be used for TCP on non unix systems pub tcp_port: u64, } @@ -368,6 +371,7 @@ impl Default for Daemon { enabled: false, sync_frequency: 300, socket_path: "".to_string(), + systemd_socket: false, tcp_port: 8889, } } @@ -715,6 +719,7 @@ impl Settings { .set_default("daemon.sync_frequency", 300)? .set_default("daemon.enabled", false)? .set_default("daemon.socket_path", socket_path.to_str())? + .set_default("daemon.systemd_socket", false)? .set_default("daemon.tcp_port", 8889)? .set_default( "prefers_reduced_motion", |
