From fe507e417fa78021c6a221f6f6219379aef58382 Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Fri, 2 May 2025 19:50:03 +0800 Subject: [PATCH] add docker. --- EOM.TSHotelManagement.WebApi/Startup.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/EOM.TSHotelManagement.WebApi/Startup.cs b/EOM.TSHotelManagement.WebApi/Startup.cs index 399a1f5..200dd61 100644 --- a/EOM.TSHotelManagement.WebApi/Startup.cs +++ b/EOM.TSHotelManagement.WebApi/Startup.cs @@ -6,6 +6,7 @@ using EOM.TSHotelManagement.Shared; using EOM.TSHotelManagement.WebApi.Filter; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; @@ -38,7 +39,15 @@ namespace EOM.TSHotelManagement.WebApi public void ConfigureServices(IServiceCollection services) { // ÅäÖÃDataProtection·þÎñ - services.AddDataProtection(); + if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "docker") + { + services.AddDataProtection() + .PersistKeysToFileSystem(new DirectoryInfo("/app/keys")); + } + else + { + services.AddDataProtection(); + } services.AddSingleton(); services.AddSingleton(); -- Gitee