pub struct ServerConfigSpec {
pub save_directory: Option<String>,
pub command_socket: Option<String>,
+ pub debug: Option<bool>,
}
#[derive(Debug,Clone)]
pub struct ServerConfig {
pub save_directory: String,
pub command_socket: String,
+ pub debug: bool,
}
impl TryFrom<ServerConfigSpec> for ServerConfig {
#[throws(Self::Error)]
fn try_from(spec: ServerConfigSpec) -> ServerConfig {
let ServerConfigSpec {
- save_directory, command_socket,
+ save_directory, command_socket, debug,
} = spec;
let save_directory = save_directory
command_socket = format!("{}/{}", save_directory, command_socket);
}
+ let debug = debug.unwrap_or(cfg!(debug_assertions));
+
ServerConfig {
- save_directory, command_socket,
+ save_directory, command_socket, debug,
}
}
}