| #!/bin/sh |
| set -e |
|
|
| env | while IFS='=' read -r KEY VALUE; do |
| case "$KEY" in |
| *_FILE) |
| VAR_NAME="${KEY%_FILE}" |
|
|
| |
| if [ -n "$(printenv "$VAR_NAME")" ]; then |
| continue |
| fi |
|
|
| if [ -f "$VALUE" ]; then |
| export "$VAR_NAME=$(tr -d '\r\n' < "$VALUE")" |
| fi |
| ;; |
| esac |
| done |
|
|
| |
| 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 |
| export APP_KEY=$(php artisan key:generate --show --no-interaction) |
| 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}" |
|
|