♻️ refactor: use new file_server::Config in ptth_server
parent
009601e136
commit
31750d30fc
|
@ -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,8 +210,10 @@ 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: file_server::Config {
|
||||||
file_server_root: config_file.file_server_root,
|
file_server_root: config_file.file_server_root,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
handlebars,
|
handlebars,
|
||||||
instance_metrics,
|
instance_metrics,
|
||||||
gauges: RwLock::new (file_server::metrics::Gauges {
|
gauges: RwLock::new (file_server::metrics::Gauges {
|
||||||
|
|
Loading…
Reference in New Issue