fix: configure Data Protection to persist keys using a docker volume
Deploy Telegram Bot / deploy (push) Successful in 2m52s

This commit is contained in:
2026-04-17 13:35:49 +03:00
parent 052cfc3521
commit 09979252f7
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -45,8 +45,12 @@ services:
- "ConnectionStrings__gmrelaydb=Host=127.0.0.1;Port=5432;Database=gmrelay_db;Username=gmrelay;Password=${POSTGRES_PASSWORD}"
- "Telegram__BotToken=${TELEGRAM_BOT_TOKEN}"
- "Telegram__BotUsername=${TELEGRAM_BOT_USERNAME}"
volumes:
- web_keys:/app/dataprotection-keys
volumes:
pgdata:
external: true
name: game_pgdata
web_keys:
name: gmrelay_web_keys
+5
View File
@@ -2,6 +2,7 @@ using GmRelay.Web.Components;
using GmRelay.Web.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.DataProtection;
using System.Security.Claims;
using Telegram.Bot;
using Npgsql;
@@ -11,6 +12,10 @@ var builder = WebApplication.CreateBuilder(args);
// Add Aspire service defaults
builder.AddServiceDefaults();
// Add Data Protection
builder.Services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo("/app/dataprotection-keys"));
// Add Npgsql
builder.AddNpgsqlDataSource("gmrelaydb");