Add config_path command-line option

main
_ 2020-11-18 22:48:15 +00:00
parent d8173e61b5
commit 3293b3e7f9
1 changed files with 7 additions and 2 deletions

View File

@ -9,13 +9,18 @@ use tracing::debug;
#[derive (Debug, StructOpt)] #[derive (Debug, StructOpt)]
struct Opt { struct Opt {
//#[structopt (long)]
//file_server_root: Option <PathBuf>,
#[structopt (long)] #[structopt (long)]
file_server_root: Option <PathBuf>, config_path: Option <PathBuf>,
} }
fn main () -> Result <(), Box <dyn Error>> { fn main () -> Result <(), Box <dyn Error>> {
let opt = Opt::from_args ();
tracing_subscriber::fmt::init (); tracing_subscriber::fmt::init ();
let path = PathBuf::from ("./config/ptth_server.toml"); let path = opt.config_path.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::load_toml::load (&path);
let mut rt = if false { let mut rt = if false {