Skip to main content

momus_diff/
config.rs

1use serde::{Deserialize, Serialize};
2
3/// Configuration for a diff run.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct DiffConfig {
6    /// Baseline environment URL (e.g. production).
7    pub baseline_url: String,
8    /// Target environment URL (e.g. staging, new deployment).
9    pub target_url: String,
10    /// Whether to diff response headers.
11    #[serde(default = "default_true")]
12    pub diff_headers: bool,
13    /// Whether to diff response bodies.
14    #[serde(default = "default_true")]
15    pub diff_bodies: bool,
16    /// Whether to diff status codes.
17    #[serde(default = "default_true")]
18    pub diff_status: bool,
19    /// Request timeout in seconds.
20    #[serde(default = "default_timeout")]
21    pub timeout_secs: u64,
22}
23
24fn default_true() -> bool {
25    true
26}
27
28fn default_timeout() -> u64 {
29    30
30}
31
32impl Default for DiffConfig {
33    fn default() -> Self {
34        Self {
35            baseline_url: String::new(),
36            target_url: String::new(),
37            diff_headers: true,
38            diff_bodies: true,
39            diff_status: true,
40            timeout_secs: default_timeout(),
41        }
42    }
43}