♻️ 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);
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 ()
.unwrap_or (&default_root);
@ -172,7 +172,7 @@ impl ConfigFile {
#[derive (Default)]
pub struct Config {
pub relay_url: String,
pub file_server_root: Option <PathBuf>,
pub file_server: file_server::Config,
}
pub async fn run_server (
@ -210,8 +210,10 @@ pub async fn run_server (
let state = Arc::new (ServerState {
config: Config {
relay_url: config_file.relay_url,
file_server: file_server::Config {
file_server_root: config_file.file_server_root,
},
},
handlebars,
instance_metrics,
gauges: RwLock::new (file_server::metrics::Gauges {