Skip to content

Commit

Permalink
Fix setting app key for dusk env
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Jan 10, 2025
1 parent 69d48c8 commit b1a36b2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docker/development/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ if [ ! -f artisan ]; then
exit 1
fi

_keygen() {
if ! grep -q '^APP_KEY=.' "$1"; then
echo "Generating app key for env file '$1'"
sed -i -e '/^APP_KEY=.*/d' "$1"
echo "APP_KEY=base64:$(openssl rand -base64 32)" >> "$1"
fi
}

_run() {
docker compose run --rm php "$@"
}
Expand All @@ -37,10 +45,7 @@ _run composer install

_run artisan dusk:chrome-driver

if ! grep -q '^APP_KEY=.' .env; then
echo "Generating app key"
_run artisan key:generate
fi
_keygen .env

if [ ! -f .env.testing ]; then
echo "Copying default test env file"
Expand All @@ -50,9 +55,8 @@ fi
if [ ! -f .env.dusk.local ]; then
echo "Copying default dusk env file"
cp .env.dusk.local.example .env.dusk.local
echo "Generating app key for dusk"
_run_dusk artisan key:generate
fi
_keygen .env.dusk.local

if [ -d storage/oauth-public.key ]; then
echo "oauth-public.key is a directory. Removing it"
Expand Down

0 comments on commit b1a36b2

Please sign in to comment.