♻️ refactor: move file server config into file_server
parent
e8d94da661
commit
009601e136
|
@ -32,13 +32,8 @@ use ptth_server::{
|
|||
load_toml,
|
||||
};
|
||||
|
||||
#[derive (Default)]
|
||||
pub struct Config {
|
||||
pub file_server_root: Option <PathBuf>,
|
||||
}
|
||||
|
||||
struct ServerState <'a> {
|
||||
config: Config,
|
||||
config: file_server::Config,
|
||||
handlebars: handlebars::Handlebars <'a>,
|
||||
instance_metrics: metrics::Startup,
|
||||
hidden_path: Option <PathBuf>,
|
||||
|
@ -112,7 +107,7 @@ async fn main () -> Result <(), anyhow::Error> {
|
|||
debug! ("{:?}", instance_metrics);
|
||||
|
||||
let state = Arc::new (ServerState {
|
||||
config: Config {
|
||||
config: file_server::Config {
|
||||
file_server_root: config_file.file_server_root,
|
||||
},
|
||||
handlebars,
|
||||
|
|
|
@ -9,7 +9,10 @@ use std::{
|
|||
collections::HashMap,
|
||||
convert::{Infallible, TryFrom},
|
||||
io::SeekFrom,
|
||||
path::Path,
|
||||
path::{
|
||||
Path,
|
||||
PathBuf,
|
||||
},
|
||||
};
|
||||
|
||||
use handlebars::Handlebars;
|
||||
|
@ -53,6 +56,11 @@ mod emoji {
|
|||
pub const ERROR: &str = "\u{26a0}\u{fe0f}";
|
||||
}
|
||||
|
||||
#[derive (Default)]
|
||||
pub struct Config {
|
||||
pub file_server_root: Option <PathBuf>,
|
||||
}
|
||||
|
||||
#[derive (Serialize)]
|
||||
struct DirEntryJson {
|
||||
name: String,
|
||||
|
|
Loading…
Reference in New Issue