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
use dirs;
use serde_derive::{Deserialize, Serialize};
use super::log_exit;
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct JinxFiles {
pub jinx_home: String,
pub jinx_conf: String,
pub nginx_conf: String,
pub letsencrypt_conf: String,
pub letsencrypt_www: String,
}
pub fn get_jinx_files() -> JinxFiles {
let home_dir = match dirs::home_dir() {
None => log_exit!("[JINX] Failed to get home directory"),
Some(dir) => dir,
};
let jinx_home = format!("{}/.jinx", home_dir.display());
let jinx_conf = format!("{}/jinx_conf.json", jinx_home);
let nginx_conf = format!("{}/nginx.conf", jinx_home);
let letsencrypt_conf = format!("{}/letsencrypt/conf", jinx_home);
let letsencrypt_www = format!("{}/letsencrypt/www", jinx_home);
JinxFiles {
jinx_home,
jinx_conf,
nginx_conf,
letsencrypt_conf,
letsencrypt_www,
}
}