♻️ Move load_toml into server
parent
c4108f6f2f
commit
a6ecb1c6a8
|
@ -103,7 +103,7 @@ async fn main () -> Result <(), Box <dyn Error>> {
|
||||||
tracing_subscriber::fmt::init ();
|
tracing_subscriber::fmt::init ();
|
||||||
|
|
||||||
let path = PathBuf::from ("./config/ptth_server.toml");
|
let path = PathBuf::from ("./config/ptth_server.toml");
|
||||||
let config_file: ConfigFile = ptth::load_toml::load (&path);
|
let config_file: ConfigFile = ptth::server::load_toml::load (&path);
|
||||||
info! ("file_server_root: {:?}", config_file.file_server_root);
|
info! ("file_server_root: {:?}", config_file.file_server_root);
|
||||||
|
|
||||||
let addr = SocketAddr::from(([0, 0, 0, 0], 4000));
|
let addr = SocketAddr::from(([0, 0, 0, 0], 4000));
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn main () -> Result <(), Box <dyn Error>> {
|
||||||
|
|
||||||
tracing_subscriber::fmt::init ();
|
tracing_subscriber::fmt::init ();
|
||||||
let path = opt.config_path.clone ().unwrap_or_else (|| PathBuf::from ("./config/ptth_server.toml"));
|
let path = opt.config_path.clone ().unwrap_or_else (|| PathBuf::from ("./config/ptth_server.toml"));
|
||||||
let config_file: ptth::server::ConfigFile = ptth::load_toml::load (&path);
|
let config_file: ptth::server::ConfigFile = ptth::server::load_toml::load (&path);
|
||||||
|
|
||||||
if opt.print_tripcode {
|
if opt.print_tripcode {
|
||||||
println! (r#""{}" = "{}""#, config_file.name, config_file.tripcode ());
|
println! (r#""{}" = "{}""#, config_file.name, config_file.tripcode ());
|
||||||
|
|
|
@ -8,7 +8,6 @@ pub const PTTH_MAGIC_HEADER: &str = "X-PTTH-2LJYXWC4";
|
||||||
pub mod git_version;
|
pub mod git_version;
|
||||||
pub mod graceful_shutdown;
|
pub mod graceful_shutdown;
|
||||||
pub mod http_serde;
|
pub mod http_serde;
|
||||||
pub mod load_toml;
|
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
pub mod relay;
|
pub mod relay;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|
|
@ -537,7 +537,7 @@ async fn internal_serve_all (
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
let file_md = file.metadata ().await.unwrap ();
|
let file_md = file.metadata ().await.unwrap ();
|
||||||
if file_md.permissions ().mode () == crate::load_toml::CONFIG_PERMISSIONS_MODE
|
if file_md.permissions ().mode () == super::load_toml::CONFIG_PERMISSIONS_MODE
|
||||||
{
|
{
|
||||||
return Forbidden;
|
return Forbidden;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod file_server;
|
pub mod file_server;
|
||||||
|
pub mod load_toml;
|
||||||
|
|
||||||
// Thanks to https://github.com/robsheldon/bad-passwords-index
|
// Thanks to https://github.com/robsheldon/bad-passwords-index
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue