fix: configure Data Protection to persist keys using a docker volume
Deploy Telegram Bot / deploy (push) Successful in 2m52s
Deploy Telegram Bot / deploy (push) Successful in 2m52s
This commit is contained in:
@@ -45,8 +45,12 @@ services:
|
|||||||
- "ConnectionStrings__gmrelaydb=Host=127.0.0.1;Port=5432;Database=gmrelay_db;Username=gmrelay;Password=${POSTGRES_PASSWORD}"
|
- "ConnectionStrings__gmrelaydb=Host=127.0.0.1;Port=5432;Database=gmrelay_db;Username=gmrelay;Password=${POSTGRES_PASSWORD}"
|
||||||
- "Telegram__BotToken=${TELEGRAM_BOT_TOKEN}"
|
- "Telegram__BotToken=${TELEGRAM_BOT_TOKEN}"
|
||||||
- "Telegram__BotUsername=${TELEGRAM_BOT_USERNAME}"
|
- "Telegram__BotUsername=${TELEGRAM_BOT_USERNAME}"
|
||||||
|
volumes:
|
||||||
|
- web_keys:/app/dataprotection-keys
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
external: true
|
external: true
|
||||||
name: game_pgdata
|
name: game_pgdata
|
||||||
|
web_keys:
|
||||||
|
name: gmrelay_web_keys
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using GmRelay.Web.Components;
|
|||||||
using GmRelay.Web.Services;
|
using GmRelay.Web.Services;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
@@ -11,6 +12,10 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
// Add Aspire service defaults
|
// Add Aspire service defaults
|
||||||
builder.AddServiceDefaults();
|
builder.AddServiceDefaults();
|
||||||
|
|
||||||
|
// Add Data Protection
|
||||||
|
builder.Services.AddDataProtection()
|
||||||
|
.PersistKeysToFileSystem(new DirectoryInfo("/app/dataprotection-keys"));
|
||||||
|
|
||||||
// Add Npgsql
|
// Add Npgsql
|
||||||
builder.AddNpgsqlDataSource("gmrelaydb");
|
builder.AddNpgsqlDataSource("gmrelaydb");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user