bootstrap rust services, auth, and compose stack

This commit is contained in:
2026-03-05 14:51:02 +01:00
parent 1238079454
commit 88db9805b5
25 changed files with 3576 additions and 22 deletions

47
crates/core/src/config.rs Normal file
View File

@@ -0,0 +1,47 @@
use anyhow::{Context, Result};
#[derive(Debug, Clone)]
pub struct ApiConfig {
pub listen_addr: String,
pub database_url: String,
pub api_bootstrap_token: String,
}
impl ApiConfig {
pub fn from_env() -> Result<Self> {
Ok(Self {
listen_addr: std::env::var("API_LISTEN_ADDR").unwrap_or_else(|_| "0.0.0.0:8080".to_string()),
database_url: std::env::var("DATABASE_URL").context("DATABASE_URL is required")?,
api_bootstrap_token: std::env::var("API_BOOTSTRAP_TOKEN")
.context("API_BOOTSTRAP_TOKEN is required")?,
})
}
}
#[derive(Debug, Clone)]
pub struct IndexerConfig {
pub listen_addr: String,
}
impl IndexerConfig {
pub fn from_env() -> Self {
Self {
listen_addr: std::env::var("INDEXER_LISTEN_ADDR")
.unwrap_or_else(|_| "0.0.0.0:8081".to_string()),
}
}
}
#[derive(Debug, Clone)]
pub struct AdminUiConfig {
pub listen_addr: String,
}
impl AdminUiConfig {
pub fn from_env() -> Self {
Self {
listen_addr: std::env::var("ADMIN_UI_LISTEN_ADDR")
.unwrap_or_else(|_| "0.0.0.0:8082".to_string()),
}
}
}