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:
Niko Marmeladkov 2026-07-05 22:31:48 +03:00
parent 00eb7cdd24
commit 27c3d339c6
Signed by untrusted user who does not match committer: Niko
GPG key ID: E3B955F9442D44E3
2 changed files with 7 additions and 0 deletions

View file

@ -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,
}

View file

@ -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());