Block app from running if variables not set

This commit is contained in:
myrmidex 2025-06-30 20:41:38 +02:00
parent 9ac8e7d5ed
commit c5b287ed87

View file

@ -3,6 +3,17 @@
# Exit on any error # Exit on any error
set -e set -e
# Check required Lemmy environment variables
if [ -z "$LEMMY_INSTANCE" ] || [ -z "$LEMMY_USERNAME" ] || [ -z "$LEMMY_PASSWORD" ] || [ -z "$LEMMY_COMMUNITY" ]; then
echo "ERROR: Missing required Lemmy configuration variables:"
echo " LEMMY_INSTANCE=${LEMMY_INSTANCE:-'(not set)'}"
echo " LEMMY_USERNAME=${LEMMY_USERNAME:-'(not set)'}"
echo " LEMMY_PASSWORD=${LEMMY_PASSWORD:-'(not set)'}"
echo " LEMMY_COMMUNITY=${LEMMY_COMMUNITY:-'(not set)'}"
echo "Please set all required environment variables before starting the application."
exit 1
fi
# Wait for database to be ready # Wait for database to be ready
until php artisan tinker --execute="DB::connection()->getPdo();" > /dev/null 2>&1; do until php artisan tinker --execute="DB::connection()->getPdo();" > /dev/null 2>&1; do
echo "Waiting for database connection..." echo "Waiting for database connection..."