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:
2
.env
2
.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=
|
||||
ENCRYPTION_KEY=aaaaaaaaa
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user