Compare commits

...

3 commits

Author SHA1 Message Date
8de12c45cf
Cargo: Bump version to 0.4.0 2024-09-12 03:33:52 +02:00
f00b7d0133
Main: Notify systemd about being ready after writing to the output path via sd_notify
When running in a systemd service with the --idle flag we
want to have systemd's service dependency chain depend on
the templated secret file being written to the output path.
2024-09-12 03:30:14 +02:00
9716019cfb
Dependencies: Add sd_notify 2024-09-12 03:30:01 +02:00
3 changed files with 13 additions and 2 deletions

9
Cargo.lock generated
View file

@ -288,13 +288,20 @@ version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "sd-notify"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4646d6f919800cd25c50edb49438a1381e2cd4833c027e75e8897981c50b8b5e"
[[package]]
name = "secrets-file-builder"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"anyhow",
"clap",
"handlebars",
"sd-notify",
"serde_json",
"url-escape",
]

View file

@ -1,6 +1,6 @@
[package]
name = "secrets-file-builder"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["networkException <git@nwex.de>"]
license = "BSD-2-Clause"
@ -12,5 +12,6 @@ repository = "https://git.nwex.de/networkException/secrets-file-builder"
anyhow = "1.0.88"
clap = { version = "4.5.17", features = ["derive"] }
handlebars = "5.1.0"
sd-notify = "0.4.2"
serde_json = "1.0.114"
url-escape = "0.1.1"

View file

@ -6,6 +6,7 @@ use std::thread;
use anyhow::Result;
use clap::Parser;
use sd_notify::NotifyState;
use serde_json::{Map, Value};
use url_escape;
@ -98,6 +99,8 @@ fn main() -> Result<()> {
fs::write(&output_path, output)
.expect(format!("To be able to write to '{}'", output_path.to_string_lossy()).as_str());
sd_notify::notify(true, &[NotifyState::Ready])?;
if idle {
loop {
thread::park();