WP-00: project skeleton with three-level test harness
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / ui (push) Has been cancelled

Cargo workspace (domain, application, infrastructure, api), axum health endpoint
with SPA fallback, Vue 3 + Tailwind frontend, Vitest, Playwright, Makefile,
Gitea Actions CI and README.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-02 21:28:21 +02:00
parent 741c5e35ad
commit 780c84098b
44 changed files with 8419 additions and 14 deletions

View File

@ -0,0 +1,35 @@
//! Runtime configuration read from environment variables (see `.env.example`).
use std::net::SocketAddr;
#[derive(Clone, Debug)]
pub struct Config {
pub database_url: String,
pub jwt_secret: String,
pub bind: SocketAddr,
pub bootstrap_admin: Option<(String, String)>,
pub cookie_secure: bool,
pub frontend_dir: String,
}
impl Config {
pub fn from_env() -> anyhow::Result<Self> {
let env = |k: &str| std::env::var(k).ok().filter(|v| !v.is_empty());
let jwt_secret =
env("JWT_SECRET").ok_or_else(|| anyhow::anyhow!("JWT_SECRET is required"))?;
anyhow::ensure!(
jwt_secret.len() >= 32,
"JWT_SECRET must be at least 32 characters"
);
Ok(Self {
database_url: env("DATABASE_URL")
.unwrap_or_else(|| "sqlite://data/monitoring.db?mode=rwc".into()),
jwt_secret,
bind: env("BIND")
.unwrap_or_else(|| "127.0.0.1:8080".into())
.parse()?,
bootstrap_admin: env("BOOTSTRAP_ADMIN_EMAIL").zip(env("BOOTSTRAP_ADMIN_PASSWORD")),
cookie_secure: env("COOKIE_SECURE").is_some_and(|v| v == "true" || v == "1"),
frontend_dir: env("FRONTEND_DIR").unwrap_or_else(|| "../frontend/dist".into()),
})
}
}