chore: switch to TOML-based configuration
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id9e80fa744f3b7e3b8abc260efdc9dd66a6a6964
This commit is contained in:
parent
7f2934338f
commit
bfd9fa485e
5 changed files with 82 additions and 29 deletions
53
config/pscand.toml
Normal file
53
config/pscand.toml
Normal 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 }
|
||||||
|
|
@ -5,7 +5,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=pscand run --config /etc/pscand/pscand.conf
|
ExecStart=pscand run --config /etc/pscand/pscand.toml
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
User=root
|
User=root
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ enum Args {
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
struct RunArgs {
|
struct RunArgs {
|
||||||
#[arg(short, long, default_value = "/etc/pscand/pscand.conf")]
|
#[arg(short, long, default_value = "/etc/pscand/pscand.toml")]
|
||||||
config: PathBuf,
|
config: PathBuf,
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue