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