1
pub mod config;
2

            
3
pub mod db;
4

            
5
//pub mod transaction;
6
pub mod account;
7
pub mod command;
8
pub mod commodity;
9
pub mod error;
10
#[cfg(feature = "scripting")]
11
pub mod script;
12
#[cfg(feature = "scripting")]
13
pub mod script_mgmt;
14
pub mod split;
15
pub mod tag;
16
pub mod user;
17
use exitfailure::ExitFailure;
18
use sqlx::any::install_default_drivers;
19
use tokio::{runtime::Handle, task::JoinHandle};
20

            
21
#[macro_use]
22
extern crate rust_i18n;
23

            
24
i18n!("locales", fallback = "en");
25

            
26
async fn boot() -> Result<(), ExitFailure> {
27
    install_default_drivers();
28
    db::migrate_db().await?;
29
    config::load_config().await?;
30

            
31
    log::debug!(
32
        "The initialized: {}",
33
        config::config("initialized").await?.unwrap()
34
    );
35

            
36
    log::info!("{}", &t!("The server boot complete"));
37
    Ok(())
38
}
39

            
40
pub async fn start() -> JoinHandle<Result<(), ExitFailure>> {
41
    let handle = Handle::current();
42

            
43
    handle.spawn(boot())
44
}