From bfd9fa485e5d452e09c6f6cbbb9c7731bd9e87fc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 19 Feb 2026 00:49:21 +0300 Subject: [PATCH] chore: switch to TOML-based configuration Signed-off-by: NotAShelf Change-Id: Id9e80fa744f3b7e3b8abc260efdc9dd66a6a6964 --- config/pscand.toml | 53 +++++++++++++++++++ ...scand.example.conf => pscand.example.toml} | 0 contrib/systemd/pscand.service | 2 +- crates/pscand-cli/src/main.rs | 2 +- 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 config/pscand.toml rename contrib/{pscand.example.conf => pscand.example.toml} (100%) diff --git a/config/pscand.toml b/config/pscand.toml new file mode 100644 index 0000000..7c8baee --- /dev/null +++ b/config/pscand.toml @@ -0,0 +1,53 @@ +# pscand configuration file +# Place this at /etc/pscand/pscand.toml or ~/.config/pscand/pscand.toml + +# Directories to load scanner plugins from +# Set via PSCAND_SCANNER_DIRS environment variable or configure here +scanner_dirs = [ + # Examples (uncomment and adjust for your system): + # "/usr/lib/pscand/scanners", + # "/var/lib/pscand/scanners", + "~/.local/share/pscand/scanners", +] + +# Where to store log files +log_dir = "/var/log/pscand" + +# Number of recent log entries to keep in memory for crash recovery +ring_buffer_size = 60 + +# Enable logging to systemd journal +journal_enabled = true + +# Enable logging to file +file_enabled = true + +# Log retention in days +retention_days = 7 + +# Per-scanner configuration +[scanners.system] +enabled = true +interval_secs = 5 # Override default 1-second interval + +[scanners.sensor] +enabled = true +interval_secs = 10 # Sensors don't change as fast + +[scanners.power] +enabled = true +interval_secs = 30 # Battery status changes slowly + +[scanners.proc] +enabled = true +interval_secs = 5 + +# Example: Disable a scanner +[scanners.system] +enabled = false + +# Example: Custom scanner with extra parameters +[scanners.custom] +enabled = true +interval_secs = 60 +extra = { custom_param = "value", threshold = 100 } diff --git a/contrib/pscand.example.conf b/contrib/pscand.example.toml similarity index 100% rename from contrib/pscand.example.conf rename to contrib/pscand.example.toml diff --git a/contrib/systemd/pscand.service b/contrib/systemd/pscand.service index f062179..b926480 100644 --- a/contrib/systemd/pscand.service +++ b/contrib/systemd/pscand.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple -ExecStart=pscand run --config /etc/pscand/pscand.conf +ExecStart=pscand run --config /etc/pscand/pscand.toml Restart=on-failure RestartSec=5 User=root diff --git a/crates/pscand-cli/src/main.rs b/crates/pscand-cli/src/main.rs index dcae7f8..ec1c362 100644 --- a/crates/pscand-cli/src/main.rs +++ b/crates/pscand-cli/src/main.rs @@ -27,7 +27,7 @@ enum Args { #[derive(Parser, Debug)] struct RunArgs { - #[arg(short, long, default_value = "/etc/pscand/pscand.conf")] + #[arg(short, long, default_value = "/etc/pscand/pscand.toml")] config: PathBuf, #[arg(short, long)]