generated from coop-cloud/example
38 lines
1013 B
Bash
38 lines
1013 B
Bash
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
file_env() {
|
|
local var="$1"
|
|
local fileVar="${var}_FILE"
|
|
local def="${2:-}"
|
|
|
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
|
exit 1
|
|
fi
|
|
|
|
local val="$def"
|
|
if [ "${!var:-}" ]; then
|
|
val="${!var}"
|
|
elif [ "${!fileVar:-}" ]; then
|
|
val="$(< "${!fileVar}")"
|
|
fi
|
|
|
|
export "$var"="$val"
|
|
unset "$fileVar"
|
|
}
|
|
|
|
file_env "DB_PWD"
|
|
file_env "JWT_SECRET"
|
|
|
|
CONFIG=/etc/onlyoffice/documentserver/local.json
|
|
JSON_BIN=/var/www/onlyoffice/documentserver/npm/json
|
|
JSON="${JSON_BIN} -q -f ${CONFIG}"
|
|
${JSON} -I -e "if(this.services.CoAuthoring.autoAssembly===undefined)this.services.CoAuthoring.autoAssembly={};"
|
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.enable = ${AUTO_ASSEMBLY_ENABLED}"
|
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.interval = '${AUTO_ASSEMBLY_INTERVAL}'"
|
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.step = '${AUTO_ASSEMBLY_STEP}'"
|
|
|
|
/app/ds/run-document-server.sh
|