clrghouz/init-php.sh
2021-07-19 00:55:25 +10:00

34 lines
740 B
Bash
Executable File

#!/bin/bash
set -e
BASE_DIR=storage/app
# If DB_HOST not set, source the env file
[ -z "${DB_HOST}" -a -r .env ] && . .env
if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
sleep 1;
done
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
fi
# If FIDO_DIR not set, source the env file
[ -z "${FIDO_DIR}" -a -r .env ] && . .env
FIDO_DIR=${FIDO_DIR:-fido}
if [ ! -d "${BASE_DIR}/${FIDO_DIR}" ]; then
if ! mkdir ${BASE_DIR}/${FIDO_DIR}; then
echo "! ERROR creating FIDO_DIR [${BASE_DIR}/${FIDO_DIR}]"
exit 1
fi
fi
echo "* Ready to start server"
echo " - INBOUND [${BASE_DIR}/${FIDO_DIR}]"
./artisan server:start