Lines
0 %
Functions
Branches
100 %
#![recursion_limit = "256"]
pub mod auth_keys;
pub mod bootstrap;
pub mod config;
pub mod db;
//pub mod transaction;
pub mod account;
#[cfg(feature = "scripting")]
pub mod artifact_mgmt;
pub mod command;
pub mod commodity;
pub mod error;
pub mod provision;
pub mod script;
pub mod split;
pub mod tag;
pub mod user;
use exitfailure::ExitFailure;
use sqlx::any::install_default_drivers;
use tokio::{runtime::Handle, task::JoinHandle};
#[macro_use]
extern crate rust_i18n;
i18n!("locales", fallback = "en");
/// Runs the one-time-per-DB boot sequence: install sqlx drivers, migrate the
/// admin DB, run the idempotent global seed (`seed_complete`-guarded), and load
/// config. Every startup path MUST call this before reading config — the web
/// binary calls it directly; the CLI/server path goes through [`start`]. Safe
/// to call on an already-booted DB (migrate + seed are idempotent).
pub async fn boot() -> Result<(), ExitFailure> {
install_default_drivers();
db::migrate_db().await?;
bootstrap::seed().await?;
config::load_config().await?;
log::info!("{}", &t!("The server boot complete"));
Ok(())
}
pub async fn start() -> JoinHandle<Result<(), ExitFailure>> {
let handle = Handle::current();
handle.spawn(boot())