mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
Support reloading via systemd (#3144)
This commit is contained in:
parent
dc56a3217d
commit
b7e682c43f
|
@ -7,7 +7,7 @@ After=chronyd.service ntpd.service network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
DynamicUser=yes
|
DynamicUser=yes
|
||||||
Type=notify
|
Type=notify-reload
|
||||||
ExecStart=/usr/local/sbin/kanidm_unixd
|
ExecStart=/usr/local/sbin/kanidm_unixd
|
||||||
|
|
||||||
CacheDirectory=kanidm-unixd
|
CacheDirectory=kanidm-unixd
|
||||||
|
|
|
@ -8,7 +8,7 @@ Wants=time-sync.target network-online.target
|
||||||
Before=radiusd.service
|
Before=radiusd.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify-reload
|
||||||
DynamicUser=yes
|
DynamicUser=yes
|
||||||
StateDirectory=kanidm
|
StateDirectory=kanidm
|
||||||
StateDirectoryMode=0750
|
StateDirectoryMode=0750
|
||||||
|
|
|
@ -781,7 +781,14 @@ async fn kanidm_main(
|
||||||
tokio::signal::unix::signal(sigterm).unwrap().recv().await
|
tokio::signal::unix::signal(sigterm).unwrap().recv().await
|
||||||
} => {
|
} => {
|
||||||
// Reload TLS certificates
|
// Reload TLS certificates
|
||||||
sctx.tls_acceptor_reload().await
|
// systemd has a special reload handler for this.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Reloading]);
|
||||||
|
|
||||||
|
sctx.tls_acceptor_reload().await;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Ready]);
|
||||||
}
|
}
|
||||||
Some(()) = async move {
|
Some(()) = async move {
|
||||||
let sigterm = tokio::signal::unix::SignalKind::user_defined1();
|
let sigterm = tokio::signal::unix::SignalKind::user_defined1();
|
||||||
|
|
Loading…
Reference in a new issue