edgee_components_runtime/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use std::{collections::HashMap, path::PathBuf};

use serde::Deserialize;

#[derive(Deserialize, Debug, Default, Clone)]
pub struct ComponentsConfiguration {
    #[serde(default)]
    pub data_collection: Vec<DataCollectionComponents>,
    #[serde(default)]
    pub consent_mapping: Vec<ConsentMappingComponents>,
    pub cache: Option<PathBuf>,
}

#[derive(Deserialize, Debug, Default, Clone)]
pub struct DataCollectionComponents {
    #[serde(default)]
    pub id: String,
    pub name: String,
    pub component: String,
    pub credentials: HashMap<String, String>,
    #[serde(default)]
    pub config: DataCollectionComponentConfig,
}

#[derive(Deserialize, Debug, Clone)]
pub struct DataCollectionComponentConfig {
    pub anonymization: bool,
    pub default_consent: String,
    pub track_event_enabled: bool,
    pub user_event_enabled: bool,
    pub page_event_enabled: bool,
}

impl Default for DataCollectionComponentConfig {
    fn default() -> Self {
        DataCollectionComponentConfig {
            anonymization: true,
            default_consent: "pending".to_string(),
            track_event_enabled: true,
            user_event_enabled: true,
            page_event_enabled: true,
        }
    }
}

#[derive(Deserialize, Debug, Default, Clone)]
pub struct ConsentMappingComponents {
    pub name: String,
    pub component: String,
    #[serde(default)]
    pub config: ConsentMappingComponentConfig,
}

#[derive(Deserialize, Debug, Clone)]
pub struct ConsentMappingComponentConfig {
    pub cookie_name: String,
}

impl Default for ConsentMappingComponentConfig {
    fn default() -> Self {
        ConsentMappingComponentConfig {
            cookie_name: "".to_string(),
        }
    }
}