add --state-dir (-D) flag to persist enabled/logs/pid across reboots
socket stays in /tmp/rss/rss.sock so client commands need no extra args; state dir is controlled by RSS_STATE_DIR or --state-dir and stores enabled flags, logs, and daemon.pid in a persistent location.
This commit is contained in:
parent
00eb7cdd24
commit
27c3d339c6
2 changed files with 7 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ pub struct Cli {
|
|||
#[arg(short = 'C', long, global = true, help = "Path to config file")]
|
||||
pub config: Option<String>,
|
||||
|
||||
#[arg(short = 'D', long, global = true, help = "Path to state directory (default: /tmp/rss or $RSS_STATE_DIR)")]
|
||||
pub state_dir: Option<String>,
|
||||
|
||||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
fn main() {
|
||||
let cli = Cli::parse();
|
||||
|
||||
if let Some(ref dir) = cli.state_dir {
|
||||
std::env::set_var("RSS_STATE_DIR", dir);
|
||||
}
|
||||
|
||||
match cli.command {
|
||||
Commands::Daemon => {
|
||||
let config_path = resolve_config_path(cli.config.as_deref());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue