From 039c65f8b58e6f0bf2bce31e0af46c64afa98e47 Mon Sep 17 00:00:00 2001 From: chloe Date: Fri, 20 Mar 2026 19:05:34 +0000 Subject: [PATCH] update the docker file --- Seasoned.Backend/Program.cs | 8 ++++++-- compose.yaml | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Seasoned.Backend/Program.cs b/Seasoned.Backend/Program.cs index 7aa540b..df184bc 100644 --- a/Seasoned.Backend/Program.cs +++ b/Seasoned.Backend/Program.cs @@ -15,8 +15,12 @@ Env.Load("../.env"); var builder = WebApplication.CreateBuilder(args); builder.Configuration.AddEnvironmentVariables(); -var jwtKey = builder.Configuration["Jwt:Key"] - ?? throw new InvalidOperationException("JWT Key is missing from configuration!"); +var jwtKey = builder.Configuration.GetValue("Jwt:Key"); + +if (string.IsNullOrWhiteSpace(jwtKey)) +{ + throw new InvalidOperationException("CRITICAL: JWT Key is missing or empty! Check your .env/Docker environment mapping."); +} var jwtIssuer = builder.Configuration["Jwt:Issuer"] ?? "SeasonedAPI"; var jwtAudience = builder.Configuration["Jwt:Audience"] ?? "SeasonedFrontend"; diff --git a/compose.yaml b/compose.yaml index 8bcb6b0..fc8ed79 100644 --- a/compose.yaml +++ b/compose.yaml @@ -25,9 +25,9 @@ services: environment: - GEMINI_API_KEY=${GEMINI_API_KEY} - NUXT_PUBLIC_API_BASE=${NUXT_PUBLIC_API_BASE} - - Jwt__Key=${JWT__KEY} - - Jwt__Issuer=${JWT__ISSUER} - - Jwt__Audience=${JWT__AUDIENCE} + - Jwt__Key=${JWT_KEY} + - Jwt__Issuer=${JWT_ISSUER} + - Jwt__Audience=${JWT_AUDIENCE} - ConnectionStrings__DefaultConnection=${ConnectionStrings__DefaultConnection} - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_HTTP_PORTS=8080