1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::time::Duration;

use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub(crate) struct Config {
    #[serde(with = "humantime_serde", default = "default_ping_interval")]
    pub(crate) ping_interval: Duration,
    #[serde(with = "humantime_serde", default = "default_warn_threshold")]
    pub(crate) warn_threshold: Duration,
}

fn default_ping_interval() -> Duration {
    Duration::from_secs(1)
}

fn default_warn_threshold() -> Duration {
    Duration::from_secs(5)
}