Skip to content

Commit ce42543

Browse files
authored
Merge pull request pterodactyl#2666 from Yomanz/patch-1
Use app key from environment
2 parents c20d53b + 80574e9 commit ce42543

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

docker/entrypoint.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ else
2020
touch /app/var/.env
2121

2222
## manually generate a key because key generate --force fails
23-
echo -e "Generating key."
24-
APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
25-
echo -e "Generated app key: $APP_KEY"
26-
echo -e "APP_KEY=$APP_KEY" > /app/var/.env
23+
if [ -z $APP_KEY ]; then
24+
echo -e "Generating key."
25+
APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
26+
echo -e "Generated app key: $APP_KEY"
27+
echo -e "APP_KEY=$APP_KEY" > /app/var/.env
28+
else
29+
echo -e "APP_KEY exists in environment, using that."
30+
echo -e "APP_KEY=$APP_KEY" > /app/var/.env
31+
fi
2732

2833
ln -s /app/var/.env /app/
2934
fi
@@ -77,4 +82,4 @@ yarn add cross-env
7782
yarn run build:production
7883

7984
echo -e "Starting supervisord."
80-
exec "$@"
85+
exec "$@"

0 commit comments

Comments
 (0)