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) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 18:03:52 +01:00
parent cfaa6c42ec
commit 3dd2d39222
2 changed files with 3 additions and 4 deletions

2
.env
View File

@@ -20,4 +20,4 @@ JWT_COOKIE_TTL=86400
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/${POSTGRES_DB}?serverVersion=16&charset=utf8" DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/${POSTGRES_DB}?serverVersion=16&charset=utf8"
GITEA_ENCRYPTION_KEY= ENCRYPTION_KEY=aaaaaaaaa

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace App\Service; namespace App\Service;
use App\Exception\GiteaApiException;
use RuntimeException; use RuntimeException;
use SodiumException; use SodiumException;
use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\DependencyInjection\Attribute\Autowire;
@@ -15,7 +14,7 @@ final class TokenEncryptor
private readonly bool $configured; private readonly bool $configured;
public function __construct( public function __construct(
#[Autowire('%env(GITEA_ENCRYPTION_KEY)%')] #[Autowire('%env(ENCRYPTION_KEY)%')]
string $encryptionKey, string $encryptionKey,
) { ) {
if ('' === $encryptionKey) { if ('' === $encryptionKey) {
@@ -75,7 +74,7 @@ final class TokenEncryptor
private function assertConfigured(): void private function assertConfigured(): void
{ {
if (!$this->configured) { 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.');
} }
} }
} }