File size: 1,210 Bytes
a29d91f
 
 
44a07f9
78bdf10
 
 
 
 
 
44a07f9
 
ddff827
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a8c894
a29d91f
ddff827
8a8c894
a29d91f
 
 
8a8c894
a29d91f
 
 
8a8c894
e4e075d
 
bab0968
 
 
 
a29d91f
 
ddff827
 
a29d91f
ddff827
a29d91f
 
 
60cd4ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/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}"