feat: Containerize frontend and backend services with Docker and Docker Compose, enabling environment-based API configuration.

This commit is contained in:
2025-12-23 03:34:48 +01:00
parent c441f14bfa
commit cb0ac687ca
7 changed files with 127 additions and 8 deletions

View File

@@ -94,19 +94,25 @@ async fn main() -> anyhow::Result<()> {
.allow_credentials(true);
// Add allowed origins
let mut allowed_origins = Vec::new();
for origin in &config.cors_allowed_origins {
tracing::debug!("Allowing CORS origin: {}", origin);
if let Ok(value) = origin.parse::<axum::http::HeaderValue>() {
cors = cors.allow_origin(value);
allowed_origins.push(value);
} else {
tracing::warn!("Invalid CORS origin: {}", origin);
}
}
if !allowed_origins.is_empty() {
cors = cors.allow_origin(allowed_origins);
}
// Build the application
let app = Router::new()
.nest("/api/v1", routes::api_v1_router())
.layer(cors)
.layer(auth_layer)
.layer(cors)
.layer(TraceLayer::new_for_http())
.with_state(state);