mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
* [CE/SP] Add init script to check missing secrets * Added OVERLEAF_INVITE_TOKEN_SECRET to CE compose files GitOrigin-RevId: 1bc15763edfc43782038bdfd173067230477ce94
60 lines
1.3 KiB
Bash
Executable File
60 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
REQUIRED_SECRETS="
|
|
OVERLEAF_INVITE_TOKEN_SECRET
|
|
"
|
|
|
|
MISSING_ITEMS=""
|
|
for name in ${REQUIRED_SECRETS}; do
|
|
if [[ -z "${!name}" ]]; then
|
|
MISSING_ITEMS="$MISSING_ITEMS $name"
|
|
fi
|
|
done
|
|
|
|
if [[ "$MISSING_ITEMS" == "" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
MISSING_ITEMS=$(echo "$MISSING_ITEMS" | xargs -n1 | sed 's/^/ - /')
|
|
N=$(echo "$MISSING_ITEMS" | wc -l)
|
|
cat <<EOF
|
|
------------------------------------------------------------------------
|
|
|
|
Missing required secrets
|
|
------------------------
|
|
|
|
Your configuration is missing $N required secret(s):
|
|
$MISSING_ITEMS
|
|
|
|
These secrets must be set to persistent random values and kept
|
|
stable across container restarts and upgrades. Regenerating them
|
|
will invalidate previously issued tokens stored in the database.
|
|
|
|
Generate a value with, for example:
|
|
|
|
openssl rand -base64 32
|
|
|
|
|
|
Overleaf toolkit setups:
|
|
|
|
Add the missing variable(s) to config/variables.env and restart:
|
|
|
|
github.com/overleaf/toolkit$ bin/up
|
|
|
|
|
|
docker compose setups:
|
|
|
|
Add the missing variable(s) to the sharelatex service environment
|
|
in docker-compose.yml (or your override file) and restart.
|
|
|
|
|
|
Refusing to startup, exiting in 10s.
|
|
|
|
------------------------------------------------------------------------
|
|
EOF
|
|
|
|
sleep 10
|
|
exit 101
|