whiteout/config/
mod.rs

1pub mod project;
2
3pub use project::Config;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct ConfigData {
9    pub version: String,
10    pub encryption: EncryptionConfig,
11    pub git: GitConfig,
12    pub decorations: DecorationConfig,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct EncryptionConfig {
17    pub enabled: bool,
18    pub algorithm: String,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct GitConfig {
23    pub auto_sync: bool,
24    pub pre_commit_check: bool,
25    pub diff_driver: bool,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct DecorationConfig {
30    pub inline_pattern: String,
31    pub block_start: String,
32    pub block_end: String,
33    pub partial_pattern: String,
34}
35
36impl Default for ConfigData {
37    fn default() -> Self {
38        Self {
39            version: "0.1.0".to_string(),
40            encryption: EncryptionConfig {
41                enabled: false,
42                algorithm: "aes-256-gcm".to_string(),
43            },
44            git: GitConfig {
45                auto_sync: true,
46                pre_commit_check: true,
47                diff_driver: false,
48            },
49            decorations: DecorationConfig {
50                inline_pattern: "@whiteout:".to_string(),
51                block_start: "@whiteout-start".to_string(),
52                block_end: "@whiteout-end".to_string(),
53                partial_pattern: r"\[\[.*\|\|.*\]\]".to_string(),
54            },
55        }
56    }
57}