6 ser
::{to_writer_pretty
, PrettyConfig
},
8 use serde
::{Deserialize
, Serialize
};
10 #[derive(Debug, Clone, Deserialize, Serialize)]
12 pub pub_keys
: Vec
<String
>,
13 pub smtp_relay_address
: String
,
14 pub smtp_login
: String
,
15 pub smtp_password
: String
,
19 pub fn default() -> Self {
22 smtp_relay_address
: "mail.something.com".to_string(),
23 smtp_login
: "login".to_string(),
24 smtp_password
: "password".to_string(),
28 pub fn read(file_path
: &str) -> Result
<Config
> {
29 match File
::open(file_path
) {
30 Ok(file
) => from_reader(file
).map_err(|e
| e
.into()),
31 // The file doesn't exit -> create it with default values.
33 let file
= File
::create(file_path
)?
;
34 let default_config
= Config
::default();
35 to_writer_pretty(file
, &default_config
, PrettyConfig
::new())?
;