From f87de77aa67a72e7b3c3eccefde4b0e33b193adc Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 10 Oct 2025 15:38:02 -0400 Subject: [PATCH] Code cleanup --- src/main.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9cb5d38..4a8ee2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,11 +46,6 @@ mod init { struct ApiDoc; mod cors { - // use tower_http::cors::AllowOrigin; - // use tower_http::cors::CorsLayer; - // use axum::routing::get; - // use axum::routing::Router; - pub async fn configure_cors() -> tower_http::cors::CorsLayer { // Start building the CORS layer with common settings let cors = tower_http::cors::CorsLayer::new() @@ -70,29 +65,16 @@ mod init { // Dynamically set the allowed origin based on the environment match std::env::var(icarus_envy::keys::APP_ENV).as_deref() { Ok("production") => { - // In production, allow only your specific, trusted origins let allowed_origins_env = icarus_envy::environment::get_allowed_origins().await; - // let allowed_origins: Vec = allowed_origins_env.split(",").map(|s| s.to_string()).collect(); let allowed_origins: Vec = allowed_origins_env .split(",") .map(|s| s.parse::().unwrap()) .collect(); cors.allow_origin(allowed_origins) - // cors.allow_origin(vec![""]) - /* - cors.allow_origin(vec![ - "https://www.your-production-domain.com" - .parse::() - .unwrap(), - "https://your-production-domain.com".parse().unwrap(), - ]) - */ } _ => { // Development (default): Allow localhost origins cors.allow_origin(vec![ - "http://localhost:8000".parse().unwrap(), - "http://127.0.0.1:8000".parse().unwrap(), "http://localhost:4200".parse().unwrap(), "http://127.0.0.1:4200".parse().unwrap(), ])