read socket path from the config

This commit is contained in:
Ondrej Novak 2026-07-06 22:59:36 +02:00
parent 40612cc4c2
commit e4d1fc7156
Signed by: handy
SSH Key Fingerprint: SHA256:jlNm8ijkaMl4X7+nn3zBFTJufdQgT4unKJoZVH6kYTM
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
[global]
period = 1
socket = "/var/run/collectd-unixsock"
[[graph]]
name = "cpu load"

View File

@ -11,6 +11,7 @@ pub struct Config {
#[derive(Debug, Deserialize)]
pub struct Global {
pub period: f32,
pub socket: String,
}
#[derive(Debug, Deserialize)]

View File

@ -19,9 +19,8 @@ struct Cli {
fn main() {
let args = Cli::parse();
if let Ok(mut proto) = Protocol::new("/var/run/collectd-unixsock") {
let config = parse(&args.config);
if let Ok(mut proto) = Protocol::new(&config.global.socket) {
let graphs = config
.graph
.iter()