Browse Source

stash session secret

Girish Ramakrishnan 8 years ago
parent
commit
3a8947afdf
1 changed files with 9 additions and 1 deletions
  1. 9 1
      start.sh

+ 9 - 1
start.sh

@@ -49,6 +49,14 @@ if [[ ! -f /app/data/.setup_done ]]; then
     touch /app/data/.setup_done
 fi
 
+# load session secret
+if [[ -f /app/data/secret ]]; then
+    secret=$(cat /app/data/secret)
+else
+    secret=$(uuid)
+    echo "${secret}" > /app/data/secret
+fi
+
 # Re-create config.json
 sed -e "s,##APP_ORIGIN,${APP_ORIGIN}," \
     -e "s/##MONGODB_HOST/${MONGODB_HOST}/" \
@@ -56,7 +64,7 @@ sed -e "s,##APP_ORIGIN,${APP_ORIGIN}," \
     -e "s/##MONGODB_USERNAME/${MONGODB_USERNAME}/" \
     -e "s/##MONGODB_PASSWORD/${MONGODB_PASSWORD}/" \
     -e "s/##MONGODB_DATABASE/${MONGODB_DATABASE}/" \
-    -e "s/##SECRET/$(uuid)/" \
+    -e "s/##SECRET/${secret}/" \
     /app/code/config.json.template > /run/nodebb/config.json
 
 for plugin in $(./nodebb plugins | grep 'nodebb-' | cut -f3 -d' '); do