Skip to content

Commit

Permalink
Fix base64 encoding for TOTP_VAULT_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Mar 4, 2024
1 parent d106d4b commit 96c6a19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions bootstrap/helpers/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion templates/compose/plausible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96c6a19

Please sign in to comment.