From 7329a7fd852082f0216b4f67f1912eaa601981fc Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sun, 7 Feb 2021 12:43:41 +0100 Subject: Add new configuration for docker with small script to generate or use APP_KEY. docker-compose was adjusted to use DATA_DIR. --- docker/entrypoint.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 docker/entrypoint.sh (limited to 'docker/entrypoint.sh') diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..cb0dd0f --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +echo << EOL +------------------------------------- + ____ ___ + / __/__ _______/ (_) + / _// -_) __/ _ / / + _/_/ \__/_/ \_,_/_/ + / __/__ _____ _____ ____ + _\ \/ -_) __/ |/ / -_) __/ + /___/\__/_/ |___/\__/_/ +Brought to you by getferdi.com +Support our Open Collective at: +https://opencollective.com/getferdi/ +EOL + +# Create APP key if needed +if [ ! -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** Generating Ferdi-server app key for first run ****" + adonis key:generate + source .env + echo $APP_KEY > /config/FERDI_APP_KEY.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" + sed -i "s/APP_KEY=/APP_KEY=$APP_KEY/g" /config/config.txt +elif [ -f "/config/FERDI_APP_KEY.txt" ]; + then + echo " " + echo "**** App Key found ****" + APP_KEY=$(cat /config/FERDI_APP_KEY.txt) + sed -i "s/APP_KEY=.*/APP_KEY=$APP_KEY/g" /config/config.txt + echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" +fi + +export APP_KEY=$APP_KEY + +node ace migration:run --force + +exec node server.js -- cgit v1.2.3-54-g00ecf