Use sqlite database from command line arg

This commit is contained in:
Greg Shuflin 2025-02-02 16:55:34 -08:00
parent 2fb3090d9b
commit 5c295d09df
2 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,2 @@
[default.databases.rss_data]
url = "sqlite:data.sqlite"
[default]
secret_key = "MHSePvm1msyOkYuJ7u+MtyJYCzgdHCS7QNvrk9ts+rI="

View File

@ -20,7 +20,7 @@ use user::AuthenticatedUser;
struct Args {
/// Path to the SQLite database file
#[arg(short, long)]
database: Option<String>,
database: String,
}
#[derive(Database)]
@ -44,9 +44,14 @@ fn login() -> Template {
#[launch]
fn rocket() -> _ {
let _args = Args::parse();
rocket::build()
let args = Args::parse();
let figment = rocket::Config::figment().merge((
"databases.rss_data.url",
format!("sqlite:{}", args.database),
));
rocket::custom(figment)
.mount(
"/",
routes![