chore: switch to TOML-based configuration

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id9e80fa744f3b7e3b8abc260efdc9dd66a6a6964
This commit is contained in:
raf 2026-02-19 00:49:21 +03:00
commit bfd9fa485e
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 82 additions and 29 deletions

53
config/pscand.toml Normal file
View file

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

View file

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

View file

@ -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)]