Fix base64 encoding for TOTP_VAULT_KEY

This commit is contained in:
Andras Bacsai 2024-03-04 12:50:56 +01:00
parent d106d4bd4e
commit 96c6a198d7
2 changed files with 17 additions and 5 deletions

View File

@ -1054,8 +1054,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
serviceLabels: $serviceLabels,
is_gzip_enabled: $savedService->isGzipEnabled(),
is_stripprefix_enabled: $savedService->isStripprefixEnabled(),
service_name: $serviceName));
service_name: $serviceName
));
}
}
if ($resource->server->isLogDrainEnabled() && $savedService->isLogDrainEnabled()) {
@ -1597,14 +1597,26 @@ function generateEnvValue(string $command, ?Service $service = null)
case 'PASSWORD_64':
$generatedValue = Str::password(length: 64, symbols: false);
break;
// This is not base64, it's just a random string
case 'BASE64_64':
$generatedValue = base64_encode(Str::random(64));
$generatedValue = Str::random(64);
break;
case 'BASE64_128':
$generatedValue = base64_encode(Str::random(128));
$generatedValue = Str::random(128);
break;
case 'BASE64':
case 'BASE64_32':
$generatedValue = Str::random(32);
break;
// This is base64,
case 'REALBASE64_64':
$generatedValue = base64_encode(Str::random(64));
break;
case 'REALBASE64_128':
$generatedValue = base64_encode(Str::random(128));
break;
case 'REALBASE64':
case 'REALBASE64_32':
$generatedValue = base64_encode(Str::random(32));
break;
case 'USER':

View File

@ -12,7 +12,7 @@ services:
- DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@plausible_db/plausible
- BASE_URL=$SERVICE_FQDN_PLAUSIBLE
- SECRET_KEY_BASE=$SERVICE_BASE64_64_PLAUSIBLE
- TOTP_VAULT_KEY=$SERVICE_BASE64_TOTP
- TOTP_VAULT_KEY=$SERVICE_REALBASE64_TOTP
depends_on:
- plausible_db
- plausible_events_db