♻️ refactor: use new file_server::Config in ptth_server

main
_ 2020-12-20 18:06:21 +00:00
parent 009601e136
commit 31750d30fc
1 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,7 @@ async fn handle_one_req (
debug! ("Handling request {}", req_id); debug! ("Handling request {}", req_id);
let default_root = PathBuf::from ("./"); let default_root = PathBuf::from ("./");
let file_server_root: &std::path::Path = state.config.file_server_root let file_server_root: &std::path::Path = state.config.file_server.file_server_root
.as_ref () .as_ref ()
.unwrap_or (&default_root); .unwrap_or (&default_root);
@ -172,7 +172,7 @@ impl ConfigFile {
#[derive (Default)] #[derive (Default)]
pub struct Config { pub struct Config {
pub relay_url: String, pub relay_url: String,
pub file_server_root: Option <PathBuf>, pub file_server: file_server::Config,
} }
pub async fn run_server ( pub async fn run_server (
@ -210,7 +210,9 @@ pub async fn run_server (
let state = Arc::new (ServerState { let state = Arc::new (ServerState {
config: Config { config: Config {
relay_url: config_file.relay_url, relay_url: config_file.relay_url,
file_server_root: config_file.file_server_root, file_server: file_server::Config {
file_server_root: config_file.file_server_root,
},
}, },
handlebars, handlebars,
instance_metrics, instance_metrics,