diff --git a/src/main.rs b/src/main.rs index 7c49673..8269385 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,10 @@ struct Options { #[structopt(short, long, value_name = "path", default_value = "/etc/noise-server/config.toml")] config: PathBuf, + /// Don't use config + #[structopt(short = "C", long)] + no_config: bool, + /// Path to database #[structopt(short, long, value_name = "path", default_value = DEFAULT_DATABASE_PATH)] database_path: PathBuf, @@ -93,6 +97,9 @@ async fn load_sqlite_template(sqlite_handle: &mut SqliteConnection) -> sqlx::Res } fn get_config(options: &Options) -> std::io::Result { + if options.no_config { + Ok(Config::default()) + } else { let mut config_file = File::open(&options.config)?; let mut config_string = String::new(); config_file.read_to_string(&mut config_string)?; @@ -103,4 +110,5 @@ fn get_config(options: &Options) -> std::io::Result { err ) ) +} } \ No newline at end of file