From ca0dd11336eba1ab59a53d87f191ee09ceb051f9 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 18 Jul 2024 01:41:35 +0200 Subject: [PATCH] Check for APP_KEY in every PHP Container --- .docker/php/entrypoint | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.docker/php/entrypoint b/.docker/php/entrypoint index 14745827..46ecb3c0 100755 --- a/.docker/php/entrypoint +++ b/.docker/php/entrypoint @@ -15,6 +15,11 @@ mkdir -p /app/storage/app/public || true chown -R www-data:www-data /app/packages/laravel-nami/.cookies chown -R www-data:www-data /app/storage/app +if [ $APP_KEY = "YOUR_APP_KEY" ]; then + echo "----------------------- Keinen APP KEY gefunden. Key wird generiert: $(su www-data -c 'php artisan key:generate --show') ----------------------- Füge diesen Key als APP_KEY ein ---------------------" + exit 1 +fi + if [ $1 == "horizon" ]; then wait_for_db su www-data -c 'php artisan horizon' @@ -22,10 +27,6 @@ fi if [ $1 == "app" ]; then # --------------------------- ensure appkey is set ---------------------------- - if [ $APP_KEY = "YOUR_APP_KEY" ]; then - echo "----------------------- Keinen APP KEY gefunden. Key wird generiert: $(su www-data -c 'php artisan key:generate --show') ----------------------- Füge diesen Key als APP_KEY ein ---------------------" - exit 1 - fi wait_for_db php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force su www-data -c 'php artisan migrate --force'