improvement: make config file location configurable via CLI args

This commit is contained in:
rorp
2023-02-08 07:59:26 -06:00
committed by Greg Heartsfield
parent 2e42b1b86e
commit 28b7b83a6e
4 changed files with 26 additions and 10 deletions
+8 -5
View File
@@ -11,9 +11,14 @@ use console_subscriber::ConsoleLayer;
/// Start running a Nostr relay server.
fn main() {
// configure settings from config.toml
// replace default settings with those read from config.toml
let mut settings = config::Settings::new();
let args = CLIArgs::parse();
// get config file name from args
let config_file_arg = args.config;
// configure settings from the config file (defaults to config.toml)
// replace default settings with those read from the config file
let mut settings = config::Settings::new(&config_file_arg);
// setup tracing
if settings.diagnostics.tracing {
@@ -25,8 +30,6 @@ fn main() {
}
info!("Starting up from main");
let args = CLIArgs::parse();
// get database directory from args
let db_dir_arg = args.db;