|
|
@ -381,7 +381,7 @@ impl Iterator for SendFileIterator { |
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
|
pub struct PatchConfig {
|
|
|
|
pub path: String,
|
|
|
|
pub ip: String,
|
|
|
|
pub ip: String, // TODO: this does nothing
|
|
|
|
pub port: u16,
|
|
|
|
}
|
|
|
|
|
|
|
@ -403,11 +403,22 @@ pub fn load_config() -> PatchConfig { |
|
|
|
config
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn load_motd() -> String {
|
|
|
|
let mut motd: String = "Welcome to Elseware!".to_string();
|
|
|
|
pub fn load_config_env() -> PatchConfig {
|
|
|
|
let patch_path = std::env::var("PATCHFILE_DIR").unwrap();
|
|
|
|
let patch_port = std::env::var("PATCH_PORT").unwrap().parse().unwrap();
|
|
|
|
|
|
|
|
PatchConfig {
|
|
|
|
path: patch_path,
|
|
|
|
ip: "127.0.0.1".into(),
|
|
|
|
port: patch_port,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn load_motd() -> String {
|
|
|
|
if let Ok(m) = fs::read_to_string("patch.motd") {
|
|
|
|
motd = m.clone();
|
|
|
|
m
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
"Welcome to Elseware!".to_string()
|
|
|
|
}
|
|
|
|
motd
|
|
|
|
}
|