18 lines
527 B
Bash
18 lines
527 B
Bash
#!/bin/sh
|
|
# Prepares .env. When /config is mounted, .env is restored from /config/.env and saved there on first creation.
|
|
cd "${APP_ROOT:-/var/www/html}" || exit 0
|
|
|
|
[ -f artisan ] || exit 0
|
|
|
|
if [ -d /config ] && [ -f /config/.env ]; then
|
|
echo "Using existing /config/.env"
|
|
cp /config/.env .env
|
|
elif [ ! -f .env ] && [ -f .env.example ]; then
|
|
echo "Creating .env from example"
|
|
cp .env.example .env
|
|
chown "$(stat -c %u:%g .env.example)" .env
|
|
if [ -d /config ]; then
|
|
cp .env /config/.env
|
|
fi
|
|
fi
|