Skip to main content

server_watchdog/domain/config/
server.rs

1use serde::{Deserialize, Serialize};
2use struct_input::StructInput;
3
4#[derive(Serialize, Deserialize, Debug, Clone, StructInput)]
5pub struct ServerConfig {
6    #[struct_input(format="Name")]
7    pub name: String,
8    #[struct_input(format="BaseUrl")]
9    pub base_url: Option<String>,
10    #[struct_input(format="NotAllowWhitespace")]
11    pub docker_container_name: Option<String>,
12    #[struct_input(format="NotAllowWhitespace")]
13    pub health_check_path: Option<String>,
14    #[struct_input(format="NotAllowWhitespace")]
15    pub kill_path: Option<String>,
16    #[struct_input]
17    pub log_command: Option<String>,
18}
19
20impl ServerConfig {
21    pub fn new(name: String, base_url: Option<String>, docker_container_name: Option<String>, health_check_path: Option<String>, kill_path: Option<String>, log_command: Option<String>,) -> Self {
22        Self {
23            name: String::from(name),
24            base_url,
25            docker_container_name,
26            health_check_path,
27            kill_path,
28            log_command
29        }
30    }
31}