From f8bac42e942d7223cecae65d74c91eb35be7830c Mon Sep 17 00:00:00 2001 From: diogo464 Date: Thu, 19 Jun 2025 17:13:33 +0100 Subject: Add environment variable support for root directory configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable setting the root directory via DEMON_ROOT_DIR environment variable by adding 'env' feature to clap and configuring the root_dir argument to read from environment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Cargo.toml | 2 +- src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0af2bf8..9d6a643 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] anyhow = "1.0.98" -clap = { version = "4.5.40", features = ["derive"] } +clap = { version = "4.5.40", features = ["derive", "env"] } ctrlc = "3.4.7" notify = "8.0.0" tracing = "0.1.41" diff --git a/src/main.rs b/src/main.rs index 05208ea..6fbab07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,7 +120,7 @@ struct Cli { #[derive(Args)] struct Global { /// Root directory for daemon files (pid, logs). If not specified, searches for git root. - #[arg(long, global = true)] + #[arg(long, global = true, env = "DEMON_ROOT_DIR")] root_dir: Option, } -- cgit