diff --git a/config.toml b/config.toml index c7b0ae9..01de6e0 100644 --- a/config.toml +++ b/config.toml @@ -24,7 +24,7 @@ description = "A newly created nostr-rs-relay.\n\nCustomize this with your own i # Directory for SQLite files. Defaults to the current directory. Can # also be specified (and overriden) with the "--db dirname" command # line option. -data_directory = "." +#data_directory = "." # Use an in-memory database instead of 'nostr.db'. diff --git a/src/cli.rs b/src/cli.rs index d22d112..e995af0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,8 +7,7 @@ pub struct CLIArgs { short, long, help = "Use the as the location of the database", - default_value = ".", - required = false + required = false, )] - pub db: String, + pub db: Option, } diff --git a/src/main.rs b/src/main.rs index c0a97ff..5da2b02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,13 +31,12 @@ fn main() { let args = CLIArgs::parse(); // get database directory from args - let db_dir = args.db; + let db_dir_arg = args.db; - // update with database location - if db_dir.len() > 0 { + // update with database location from args, if provided + if let Some(db_dir) = db_dir_arg { settings.database.data_directory = db_dir; } - let (_, ctrl_rx): (MpscSender<()>, MpscReceiver<()>) = syncmpsc::channel(); // run this in a new thread let handle = thread::spawn(|| {