aboutsummaryrefslogtreecommitdiffstats
path: root/docker/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker/entrypoint.sh')
-rwxr-xr-xdocker/entrypoint.sh35
1 files changed, 21 insertions, 14 deletions
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 2d1fd89..2e58abc 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3echo << EOL 3cat << EOL
4------------------------------------- 4-------------------------------------
5 ____ ___ 5 ____ ___
6 / __/__ _______/ (_) 6 / __/__ _______/ (_)
@@ -14,24 +14,31 @@ Support our Open Collective at:
14https://opencollective.com/getferdi/ 14https://opencollective.com/getferdi/
15EOL 15EOL
16 16
17key_file="${DATA_DIR}/FERDI_APP_KEY.txt"
18
19print_app_key_message() {
20 app_key=$1
21 printf '**** App key is %s. ' ${app_key}
22 printf 'You can modify `%s` to update the app key ****\n' ${key_file}
23}
24
17# Create APP key if needed 25# Create APP key if needed
18if [[ -f "${DATA_DIR}/FERDI_APP_KEY.txt" ]]; then 26if [ -z ${APP_KEY} ] && [ ! -f ${key_file} ]
19 echo " " 27then
20 echo "**** App Key found ****" 28 echo '**** Generating Ferdi-server app key for first run ****'
21 APP_KEY=$(cat /data/FERDI_APP_KEY.txt) 29 adonis key:generate
22 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****" 30 APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2)
23elif [[ -z "${APP_KEY}" ]]; then 31 echo ${APP_KEY} > ${key_file}
24 echo "**** Generating Ferdi-server app key for first run ****" 32 print_app_key_message ${APP_KEY}
25 adonis key:generate 33else
26 APP_KEY=$(grep APP_KEY .env | cut -d '=' -f2) 34 APP_KEY=$(cat ${key_file})
27 echo "${APP_KEY}" > "${DATA_DIR}/FERDI_APP_KEY.txt" 35 print_app_key_message ${APP_KEY}
28 echo "**** App Key set to $APP_KEY you can modify FERDI_APP_KEY.txt to update your key ****"
29fi 36fi
30 37
31export APP_KEY 38export APP_KEY
32 39
33node ace migration:run --force 40node ace migration:run --force
34 41
35chown -R ${PUID:-1000}:${PGID:-1000} $DATA_DIR /app 42chown -R "${PUID:-1000}":"${PGID:-1000}" "${DATA_DIR}" /app
36 43
37su-exec ${PUID:-1000}:${PGID:-1000} node server.js 44su-exec "${PUID:-1000}":"${PGID:-1000}" node server.js