#!/bin/sh
# Liara PHP platform pre-build hook — runs BEFORE composer install (no env access).
# Symfony's Dotenv::bootEnv() hard-requires a .env file to exist, and composer's
# auto-scripts (cache:clear) run during install. The real .env is excluded from the
# upload (.liaraignore) to avoid leaking dev secrets, so write a minimal prod one if
# absent. Real values come from Liara's env vars; Dotenv never overwrites a set var.
set -e

if [ ! -f .env ]; then
    printf 'APP_ENV=prod\nAPP_DEBUG=0\n' > .env
    echo "pre-build: wrote minimal prod .env"
fi
