#!/bin/sh set -e if [ -f .env ]; then while IFS='=' read -r key value; do case "$key" in ''|\#*) continue ;; esac if [ -z "$(printenv "$key")" ]; then export "$key=$value" fi done < .env fi env | while IFS='=' read -r KEY VALUE; do case "$KEY" in *_FILE) VAR_NAME="${KEY%_FILE}" # kalau ENV biasa sudah ada jangan overwrite if [ -n "$(printenv "$VAR_NAME")" ]; then continue fi if [ -f "$VALUE" ]; then export "$VAR_NAME=$(tr -d '\r\n' < "$VALUE")" fi ;; esac done # HF compatibility if [ -n "$SPACE_HOST" ] && [ "${APP_URL:-}" = "http://localhost" ]; then export APP_URL="https://$SPACE_HOST" fi if [ -n "$SPACE_HOST" ] && [ -z "${ASSET_URL:-}" ]; then export ASSET_URL="https://$SPACE_HOST" fi if [ -z "${APP_KEY:-}" ]; then APP_KEY="base64:$(openssl rand -base64 32)" export APP_KEY fi if [ ! -f .env ]; then echo "APP_KEY=${APP_KEY}" > .env fi rm -f bootstrap/cache/config.php php artisan config:clear php artisan cache:clear exec php artisan serve \ --host=0.0.0.0 \ --port="${PORT:-7860}"