1#![recursion_limit = "256"]
2
3pub mod config;
4
5pub mod db;
6
7pub mod account;
9pub mod command;
10pub mod commodity;
11pub mod error;
12#[cfg(feature = "scripting")]
13pub mod script;
14#[cfg(feature = "scripting")]
15pub mod script_mgmt;
16pub mod split;
17pub mod tag;
18pub mod user;
19use exitfailure::ExitFailure;
20use sqlx::any::install_default_drivers;
21use tokio::{runtime::Handle, task::JoinHandle};
22
23#[macro_use]
24extern crate rust_i18n;
25
26i18n!("locales", fallback = "en");
27
28async fn boot() -> Result<(), ExitFailure> {
29 install_default_drivers();
30 db::migrate_db().await?;
31 config::load_config().await?;
32
33 log::debug!(
34 "The initialized: {}",
35 config::config("initialized").await?.unwrap()
36 );
37
38 log::info!("{}", &t!("The server boot complete"));
39 Ok(())
40}
41
42pub async fn start() -> JoinHandle<Result<(), ExitFailure>> {
43 let handle = Handle::current();
44
45 handle.spawn(boot())
46}