Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate admin API key on the first run #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ if [ -n "$APP_KEY" ]; then
echo "Setting APP_KEY=$APP_KEY from environment"
sed -i "s#APP_KEY=.*#APP_KEY=$APP_KEY#" .env
else
# generate AppKey on first run
# generate AppKey and API key on first run
if [ ! -e .first_run_done ]; then
echo "Generating APP_KEY"
php artisan key:generate
echo "Generating API_KEY"
ADMIN_API_KEY=$(head -c 64 < /dev/urandom | base64 | tr -dc 'A-Za-z0-9' | head -c 64)
sed -i "s#ADMIN_API_KEY=.*#ADMIN_API_KEY=$ADMIN_API_KEY#" .env
touch .first_run_done
fi
fi
Expand Down