15 lines
411 B
Bash
15 lines
411 B
Bash
#!/bin/sh
|
|
# Generates APP_KEY only when none exists yet (env or .env), so an existing key is never rotated.
|
|
cd "${APP_ROOT:-/var/www/html}" || exit 0
|
|
|
|
[ -f artisan ] || exit 0
|
|
[ -f .env ] || exit 0
|
|
[ -n "$APP_KEY" ] && exit 0
|
|
|
|
if ! grep -Eq '^APP_KEY=.+' .env; then
|
|
echo "Generating application key"
|
|
php artisan key:generate --force --no-interaction
|
|
[ -d /config ] && cp .env /config/.env
|
|
fi
|
|
exit 0
|