From 9c332889021532ae3934968c10653d70c5e86642 Mon Sep 17 00:00:00 2001 From: Daave Date: Fri, 6 Nov 2020 13:21:09 +0000 Subject: [PATCH] Change entrypoint so it doesn't overwrite app key. APP_KEY is overwritten by a generated one even if it's in the environment. --- docker/entrypoint.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 84cf19576..42379a3fe 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -20,10 +20,15 @@ else touch /app/var/.env ## manually generate a key because key generate --force fails - echo -e "Generating key." - APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) - echo -e "Generated app key: $APP_KEY" - echo -e "APP_KEY=$APP_KEY" > /app/var/.env + if [ -z "$APP_KEY" ]; then + echo -e "Generating key." + APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + echo -e "Generated app key: $APP_KEY" + echo -e "APP_KEY=$APP_KEY" > /app/var/.env + else + echo -e "APP_KEY exists in environment, using that." + echo -e "APP_KEY=$APP_KEY" > /app/var/.env + fi ln -s /app/var/.env /app/ fi @@ -77,4 +82,4 @@ yarn add cross-env yarn run build:production echo -e "Starting supervisord." -exec "$@" \ No newline at end of file +exec "$@"