♻️ refactor inject CLI args instead of reading them in main

main
_ 2021-10-02 17:31:06 +00:00
parent 0b10737403
commit 30f8bbb0aa
2 changed files with 5 additions and 3 deletions

View File

@ -4,5 +4,7 @@
async fn main () -> anyhow::Result <()> { async fn main () -> anyhow::Result <()> {
tracing_subscriber::fmt::init (); tracing_subscriber::fmt::init ();
ptth_server::executable::main ().await let args = std::env::args_os ();
ptth_server::executable::main (args).await
} }

View File

@ -490,8 +490,8 @@ pub mod executable {
prelude::*, prelude::*,
}; };
pub async fn main () -> anyhow::Result <()> { pub async fn main (args: std::env::ArgsOs) -> anyhow::Result <()> {
let opt = Opt::from_args (); let opt = Opt::from_iter (args);
let asset_root = opt.asset_root; let asset_root = opt.asset_root;
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"));