summaryrefslogtreecommitdiff
path: root/src/config.rs
blob: 7eee27093cf9cc979210881d11034d42fd61fdc0 (plain)
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
use serde_derive::{Deserialize, Serialize};

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Server {
    pub listen: String,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Service {
    pub name: String,
    pub addr: String, // host:port
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Client {
    pub addr: String,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Root {
    pub server: Option<Server>,
    pub client: Option<Client>,
    pub service: Vec<Service>,
    #[serde(default = "default_true")]
    pub allow_help: bool,
}

fn default_true() -> bool {
    true
}