31 lines
745 B
Rust
31 lines
745 B
Rust
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::fmt()
|
|
.with_env_filter(
|
|
tracing_subscriber::EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
|
|
)
|
|
.init();
|
|
|
|
|
|
let exit_code = match real_main().await {
|
|
Ok(()) => 0,
|
|
Err(err) => {
|
|
eprintln!("Exited with error: {err:#}");
|
|
eprintln!("Closing!");
|
|
1
|
|
}
|
|
};
|
|
std::process::exit(exit_code);
|
|
}
|
|
|
|
pub async fn real_main() -> anyhow::Result<()> {
|
|
erplt_config::init()?;
|
|
tracing::info!("Starting application");
|
|
|
|
let db = erplt_db::connect(&erplt_config::Config::get().database.connect_url())?;
|
|
|
|
erplt_api::start(db).await?;
|
|
Ok(())
|
|
} |