@@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
8
8
9
9
use crate :: dirs;
10
10
11
- /* Far from an optimal way to solve it, but works and is simple */
11
+ // Far from an optimal way to solve it, but works and is simple
12
12
static mut TESTING : bool = true ;
13
13
pub fn set_testing ( testing : bool ) {
14
14
unsafe {
@@ -23,12 +23,20 @@ pub fn is_testing() -> bool {
23
23
pub struct AWConfig {
24
24
#[ serde( default = "default_address" ) ]
25
25
pub address : String ,
26
+
26
27
#[ serde( default = "default_port" ) ]
27
28
pub port : u16 ,
29
+
28
30
#[ serde( skip, default = "default_testing" ) ]
29
31
pub testing : bool , // This is not written to the config file (serde(skip))
32
+
30
33
#[ serde( default = "default_cors" ) ]
31
34
pub cors : Vec < String > ,
35
+
36
+ // A mapping of watcher names to paths where the
37
+ // custom visualizations are located.
38
+ #[ serde( default = "default_custom_static" ) ]
39
+ pub custom_static : std:: collections:: HashMap < String , String > ,
32
40
}
33
41
34
42
impl Default for AWConfig {
@@ -38,6 +46,7 @@ impl Default for AWConfig {
38
46
port : default_port ( ) ,
39
47
testing : default_testing ( ) ,
40
48
cors : default_cors ( ) ,
49
+ custom_static : default_custom_static ( ) ,
41
50
}
42
51
}
43
52
}
@@ -86,6 +95,10 @@ fn default_port() -> u16 {
86
95
}
87
96
}
88
97
98
+ fn default_custom_static ( ) -> std:: collections:: HashMap < String , String > {
99
+ std:: collections:: HashMap :: new ( )
100
+ }
101
+
89
102
pub fn create_config ( testing : bool ) -> AWConfig {
90
103
set_testing ( testing) ;
91
104
let mut config_path = dirs:: get_config_dir ( ) . unwrap ( ) ;
0 commit comments