Commit 929d4d76 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix entrypoint: write Docker env vars to .env before config:cache

Dumps runtime env vars into .env so config:cache picks them up
instead of reading stale .env.example defaults.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 59451b50
......@@ -7,17 +7,16 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
# Create .env file — Laravel needs it to exist but Docker env vars take priority
if [ ! -f .env ]; then
echo "APP_KEY=" > .env
fi
# Write Docker env vars to .env so config:cache picks them up
# This ensures runtime env vars from CapRover override .env.example defaults
env | grep -E "^(APP_|DB_|LOG_|SESSION_|CACHE_|QUEUE_|FILESYSTEM_|BROADCAST_|MAIL_|CAPROVER_|PG_ADMIN_|SHARED_PG_|ELCAPTAIN_|TRUSTED_|BCRYPT_)" | sort > .env
# Generate APP_KEY if not set via environment
# Generate APP_KEY if not set
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction
fi
# DO NOT cache config — Docker env vars must be read at runtime
php artisan config:cache
php artisan route:cache
php artisan view:cache
......
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