Commit b4f4fd5c authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix entrypoint .env generation: use sed for robust quoting

The while/read loop was failing to properly quote env values with spaces
(APP_NAME="El Captain Manager" caused dotenv parse failure). sed handles
all edge cases (spaces, multiple = signs, special chars) in one pass.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent d522d5bd
...@@ -7,11 +7,9 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca ...@@ -7,11 +7,9 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca
chown -R www-data:www-data storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache chmod -R 775 storage bootstrap/cache
# Build .env from Docker env vars (quoted to handle spaces) # Build .env from Docker env vars (quoted to handle spaces and special chars)
: > .env : > .env
env | grep -E "^(APP_|DB_|LOG_|SESSION_|CACHE_|QUEUE_|FILESYSTEM_|BROADCAST_|MAIL_|CAPROVER_|PG_ADMIN_|SHARED_PG_|ELCAPTAIN_|TRUSTED_|BCRYPT_)" | sort | while IFS='=' read -r key value; do env | grep -E "^(APP_|DB_|LOG_|SESSION_|CACHE_|QUEUE_|FILESYSTEM_|BROADCAST_|MAIL_|CAPROVER_|PG_ADMIN_|SHARED_PG_|ELCAPTAIN_|TRUSTED_|BCRYPT_)" | sort | sed 's/=\(.*\)/="\1"/' >> .env
echo "${key}=\"${value}\"" >> .env
done
# Generate APP_KEY if not already set, then ensure it's in .env # Generate APP_KEY if not already set, then ensure it's in .env
if ! grep -q "^APP_KEY=\"base64:" .env 2>/dev/null; then if ! grep -q "^APP_KEY=\"base64:" .env 2>/dev/null; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment