Initial
This commit is contained in:
19
crates/erplt/Cargo.toml
Normal file
19
crates/erplt/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "erplt"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
erplt-db.path="../erplt-db"
|
||||
erplt-api.path="../erplt-api"
|
||||
erplt-config.path="../erplt-config"
|
||||
camino.workspace = true
|
||||
clap.workspace = true
|
||||
serde.workspace = true
|
||||
toml.workspace = true
|
||||
anyhow.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
tracing.workspace = true
|
||||
humantime.workspace = true
|
||||
humantime-serde.workspace = true
|
||||
tokio.workspace = true
|
||||
31
crates/erplt/src/main.rs
Normal file
31
crates/erplt/src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#[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(())
|
||||
}
|
||||
Reference in New Issue
Block a user