From 3dd2d3922219d153cf85cc664fd6472af49c1404 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 15 Mar 2026 18:03:52 +0100 Subject: [PATCH] refactor : rename GITEA_ENCRYPTION_KEY to ENCRYPTION_KEY Generic encryption key name for shared use across Gitea and BookStack token encryption. Co-Authored-By: Claude Opus 4.6 (1M context) --- .env | 2 +- src/Service/TokenEncryptor.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 193bec9..b1d0ee8 100644 --- a/.env +++ b/.env @@ -20,4 +20,4 @@ JWT_COOKIE_TTL=86400 DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/${POSTGRES_DB}?serverVersion=16&charset=utf8" -GITEA_ENCRYPTION_KEY= \ No newline at end of file +ENCRYPTION_KEY=aaaaaaaaa \ No newline at end of file diff --git a/src/Service/TokenEncryptor.php b/src/Service/TokenEncryptor.php index 86be2ae..3038820 100644 --- a/src/Service/TokenEncryptor.php +++ b/src/Service/TokenEncryptor.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace App\Service; -use App\Exception\GiteaApiException; use RuntimeException; use SodiumException; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -15,7 +14,7 @@ final class TokenEncryptor private readonly bool $configured; public function __construct( - #[Autowire('%env(GITEA_ENCRYPTION_KEY)%')] + #[Autowire('%env(ENCRYPTION_KEY)%')] string $encryptionKey, ) { if ('' === $encryptionKey) { @@ -75,7 +74,7 @@ final class TokenEncryptor private function assertConfigured(): void { if (!$this->configured) { - throw new GiteaApiException('Gitea encryption is not configured. Please set a valid GITEA_ENCRYPTION_KEY.'); + throw new RuntimeException('Encryption is not configured. Please set a valid ENCRYPTION_KEY.'); } } }