diff --git a/server-ce/config/settings.js b/server-ce/config/settings.js index 6cd043322b..2e56ed4fc1 100644 --- a/server-ce/config/settings.js +++ b/server-ce/config/settings.js @@ -271,7 +271,7 @@ const settings = { url: 'http://localhost:3054', }, v1_history: { - url: 'http://localhost:3100/api', + url: process.env.V1_HISTORY_URL || 'http://localhost:3100/api', user: 'staging', pass: process.env.STAGING_PASSWORD, }, diff --git a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh index 3bc7d31f29..ec7e846c74 100755 --- a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh +++ b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh @@ -8,19 +8,31 @@ WEB_API_PASSWORD_FILE=/etc/container_environment/WEB_API_PASSWORD STAGING_PASSWORD_FILE=/etc/container_environment/STAGING_PASSWORD # HTTP auth for history-v1 V1_HISTORY_PASSWORD_FILE=/etc/container_environment/V1_HISTORY_PASSWORD CRYPTO_RANDOM_FILE=/etc/container_environment/CRYPTO_RANDOM +OT_JWT_AUTH_KEY_FILE=/etc/container_environment/OT_JWT_AUTH_KEY -if [ ! -f "$WEB_API_PASSWORD_FILE" ] || [ ! -f "$STAGING_PASSWORD_FILE" ] || [ ! -f "$CRYPTO_RANDOM_FILE" ]; then +generate_secret () { + dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/' +} +if [ ! -f "$WEB_API_PASSWORD_FILE" ] || + [ ! -f "$STAGING_PASSWORD_FILE" ] || + [ ! -f "$V1_HISTORY_PASSWORD_FILE" ] || + [ ! -f "$CRYPTO_RANDOM_FILE" ] || + [ ! -f "$OT_JWT_AUTH_KEY_FILE" ] +then echo "generating random secrets" - SECRET=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') - echo ${SECRET} > ${WEB_API_PASSWORD_FILE} + SECRET=$(generate_secret) + echo "${SECRET}" > ${WEB_API_PASSWORD_FILE} - SECRET=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') - echo ${SECRET} > ${STAGING_PASSWORD_FILE} - echo ${SECRET} > ${V1_HISTORY_PASSWORD_FILE} + SECRET=$(generate_secret) + echo "${SECRET}" > ${STAGING_PASSWORD_FILE} + echo "${SECRET}" > ${V1_HISTORY_PASSWORD_FILE} - SECRET=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') - echo ${SECRET} > ${CRYPTO_RANDOM_FILE} + SECRET=$(generate_secret) + echo "${SECRET}" > ${CRYPTO_RANDOM_FILE} + + SECRET=$(generate_secret) + echo "${SECRET}" > ${OT_JWT_AUTH_KEY_FILE} fi