diff --git a/server/src/state.rs b/server/src/state.rs index 6264987..43b2519 100644 --- a/server/src/state.rs +++ b/server/src/state.rs @@ -2,6 +2,8 @@ use std::collections::BTreeMap; use std::sync::Arc; use std::sync::Mutex; +use log::error; +use log::info; use sqlx::Pool; use sqlx::Sqlite; use sqlx::SqlitePool; @@ -30,6 +32,7 @@ impl ServerState { // This is almost certainly bad practice for more reasons than I can count dotenvy::dotenv().ok(); let db_url = dotenvy::var("DATABASE_URL").unwrap_or(":memory:".to_string()); + info!("Using db_url: {}", &db_url); let pool = sqlite::SqlitePoolOptions::new() .max_connections(5) @@ -39,6 +42,12 @@ impl ServerState { sqlx::migrate!("./migrations").run(&pool).await.unwrap(); + match crate::db::db_new_user("imbus".to_string(), "kartellen1234".to_string(), &pool).await + { + Some(u) => info!("Created default user {}", u.username), + None => error!("Failed to create default user..."), + } + #[cfg(debug_assertions)] debug_setup(&pool).await.unwrap();