docker: Allow option to autogenerate keys

While this isn't optimal for prod, for dev environments it can be very helpful to opt-in for things to Just Work.
This commit is contained in:
Ash Logan 2022-09-30 22:25:49 +10:00
parent 883417c05f
commit 69e8b84b14

View file

@ -1,7 +1,7 @@
#!/bin/sh
# this doesnt check game server specific certs, only static file paths
files='config.json certs/nex/datastore/secret.key certs/service/account/secret.key certs/service/account/aes.key certs/service/account/private.pem certs/service/account/public.pem'
files='config.json'
for file in $files; do
if [ ! -f $file ]; then
@ -10,4 +10,19 @@ for file in $files; do
fi
done
# check for keys
keys='certs/nex/datastore/secret.key certs/service/account/secret.key certs/service/account/aes.key certs/service/account/private.pem certs/service/account/public.pem'
for file in $keys; do
if [ ! -f "$file" ]; then
if [ x"${GENERATE_NEW_KEYS}" = "x" ]; then
echo "$PWD/$file file does not exist. Please mount and try again."
exit 1
else
echo "$PWD/$file file does not exist. Generating a temporary one"
node generate-keys.js nex datastore
node generate-keys.js account
fi
fi
done
exec node src/server.js