This commit is contained in:
2026-09-07 22:47:34 +03:00
commit 3fcee5ea9a
27 changed files with 1849 additions and 0 deletions

19
crates/erplt/Cargo.toml Normal file
View 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
View 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(())
}