fix: handle special characters in passwords during setup
All checks were successful
CI / build (push) Successful in 1m38s
CI / docker (push) Successful in 22s

- Logto entrypoint builds DB_URL from PG_USER/PG_PASSWORD/PG_HOST with
  URL-encoding via node's encodeURIComponent, instead of embedding the
  raw password in the connection string
- Installer submodule updated: passwords single-quoted in .env/.conf

Fixes SMTP and DB auth failures when passwords contain $, &, ;, [, etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-25 16:34:00 +02:00
parent c58bf90604
commit 6b77a96d52
2 changed files with 9 additions and 1 deletions

View File

@@ -1,6 +1,14 @@
#!/bin/sh
set -e
# Build DB_URL from individual env vars so passwords with special characters
# are properly URL-encoded (Logto only accepts a connection string)
if [ -z "$DB_URL" ]; then
ENCODED_PW=$(node -e "process.stdout.write(encodeURIComponent(process.env.PG_PASSWORD || ''))")
export DB_URL="postgres://${PG_USER:-cameleer}:${ENCODED_PW}@${PG_HOST:-localhost}:5432/logto"
echo "[entrypoint] Built DB_URL from PG_USER/PG_PASSWORD/PG_HOST"
fi
# Save the real public endpoints for after bootstrap
REAL_ENDPOINT="$ENDPOINT"
REAL_ADMIN_ENDPOINT="$ADMIN_ENDPOINT"