edgee_components_runtime/
config.rs1use std::{collections::HashMap, path::PathBuf};
2
3use serde::Deserialize;
4
5#[derive(Deserialize, Debug, Default, Clone)]
6pub struct ComponentsConfiguration {
7 #[serde(default)]
8 pub data_collection: Vec<DataCollectionComponents>,
9 #[serde(default)]
10 pub consent_mapping: Vec<ConsentMappingComponents>,
11 pub cache: Option<PathBuf>,
12}
13
14#[derive(Deserialize, Debug, Default, Clone)]
15pub struct DataCollectionComponents {
16 #[serde(skip_deserializing)]
17 pub project_component_id: String,
18 #[serde(skip_deserializing)]
19 pub slug: String,
20 pub id: String, pub file: String,
22 #[serde(default)]
23 pub settings: DataCollectionComponentSettings,
24}
25
26#[derive(Deserialize, Debug, Clone)]
27#[serde(default)]
28pub struct DataCollectionComponentSettings {
29 pub edgee_anonymization: bool,
30 pub edgee_default_consent: String,
31 pub edgee_track_event_enabled: bool,
32 pub edgee_user_event_enabled: bool,
33 pub edgee_page_event_enabled: bool,
34 #[serde(flatten)]
35 pub additional_settings: HashMap<String, String>,
36}
37
38impl Default for DataCollectionComponentSettings {
39 fn default() -> Self {
40 DataCollectionComponentSettings {
41 edgee_anonymization: true,
42 edgee_default_consent: "pending".to_string(),
43 edgee_track_event_enabled: true,
44 edgee_user_event_enabled: true,
45 edgee_page_event_enabled: true,
46 additional_settings: HashMap::new(),
47 }
48 }
49}
50
51#[derive(Deserialize, Debug, Default, Clone)]
52pub struct ConsentMappingComponents {
53 pub name: String,
54 pub component: String,
55 #[serde(default)]
56 pub config: ConsentMappingComponentConfig,
57}
58
59#[derive(Deserialize, Debug, Clone)]
60pub struct ConsentMappingComponentConfig {
61 pub cookie_name: String,
62}
63
64impl Default for ConsentMappingComponentConfig {
65 fn default() -> Self {
66 ConsentMappingComponentConfig {
67 cookie_name: "".to_string(),
68 }
69 }
70}