autopulse_service/settings/
opts.rs1use autopulse_utils::Rotation;
2use serde::{Deserialize, Serialize};
3use std::path::PathBuf;
4
5#[derive(Serialize, Clone, Deserialize, Default)]
6#[serde(rename_all = "lowercase")]
7pub enum LogRotation {
8 Daily,
9 Minutely,
10 Hourly,
11 #[default]
12 Never,
13}
14
15impl From<&LogRotation> for Rotation {
28 fn from(rotation: &LogRotation) -> Self {
29 match rotation {
30 LogRotation::Daily => Self::DAILY,
31 LogRotation::Minutely => Self::MINUTELY,
32 LogRotation::Hourly => Self::HOURLY,
33 LogRotation::Never => Self::NEVER,
34 }
35 }
36}
37
38#[derive(Serialize, Deserialize, Clone)]
39#[serde(default)]
40pub struct Opts {
41 pub check_path: bool,
43
44 pub max_retries: i32,
46
47 pub default_timer_wait: u64,
49
50 pub cleanup_days: u64,
52
53 pub log_file: Option<PathBuf>,
55
56 pub log_file_rollover: LogRotation,
58
59 pub webhook_retries: u8,
61
62 pub webhook_timeout: u64,
64
65 pub webhook_interval: u64,
67}
68
69impl Default for Opts {
70 fn default() -> Self {
71 Self {
72 check_path: false,
73 max_retries: 5,
74 default_timer_wait: 60,
75 cleanup_days: 10,
76 log_file: None,
77 log_file_rollover: LogRotation::default(),
78 webhook_retries: 3,
79 webhook_timeout: 10,
80 webhook_interval: 10,
81 }
82 }
83}