Call database setup from server main
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
use crate::App;
|
||||
use crate::server::config;
|
||||
use crate::server::{config, database};
|
||||
use crate::util::error::{Contextualize, Error, Result};
|
||||
|
||||
pub fn main() -> Result<()> {
|
||||
@@ -22,6 +22,12 @@ pub fn main() -> Result<()> {
|
||||
.map_err(|e| Error::message_here(e.to_string()))
|
||||
.err_context("Failed to create tokio runtime for server setup")?;
|
||||
|
||||
let _db_pool = setup_rt.block_on(async {
|
||||
database::setup(config.database.connection_uri())
|
||||
.await
|
||||
.err_context("Failed database setup")
|
||||
})?;
|
||||
|
||||
tracing::info!("Setup complete, launching web server...");
|
||||
dioxus::launch(App);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user