Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Support systemd credential for secret
Lorenz Leutgeb committed 7 months ago
commit d1c584104f50107898c44a7d00c24eca20fe3fe7
parent 6e9fc6d36dd108faf15ef7e5ed22e1975c167309
1 file changed +15 -2
modified crates/radicle-node/src/main.rs
@@ -237,8 +237,21 @@ fn execute(options: Options) -> Result<(), ExecutionError> {

    let passphrase = profile::env::passphrase();

-
    let secret_path = options
-
        .secret
+
    let secret_path = options.secret;
+

+
    #[cfg(all(feature = "systemd", target_os = "linux"))]
+
    let secret_path = secret_path.or_else(|| {
+
        const ID: &str = "xyz.radicle.node.secret";
+
        match radicle_systemd::credential::path(ID) {
+
            Err(err) => {
+
                log::warn!(target: "node", "Failed to obtain path of the secret key via systemd credential with ID '{ID}': {err}");
+
                None
+
            },
+
            Ok(path) => path
+
        }
+
    });
+

+
    let secret_path = secret_path
        .or_else(|| config.node.secret.clone())
        .unwrap_or_else(|| home.keys().join("radicle"));