From 3589af42e40638dee62e11baa2b8b482067ee1af Mon Sep 17 00:00:00 2001 From: Paco Date: Thu, 10 Nov 2022 16:11:39 +0100 Subject: [PATCH] Permit to change the forcesave options with env variables --- README.md | 3 +++ run-document-server.sh | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 39e3a717d..6165de46d 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,9 @@ Below is the complete list of parameters that can be set using environment varia - **JWT_SECRET**: Defines the secret key to validate the JSON Web Token in the request to the ONLYOFFICE Document Server. Defaults to random value. - **JWT_HEADER**: Defines the http header that will be used to send the JSON Web Token. Defaults to `Authorization`. - **JWT_IN_BODY**: Specifies the enabling the token validation in the request body to the ONLYOFFICE Document Server. Defaults to `false`. +- **FORCESAVE_ENABLE**: Whether to activate [forcesaving](https://api.onlyoffice.com/editors/save#forcesave) on the ONLYOFFICE Document Server. Defaults to `false`. +- **FORCESAVE_INTERVAL**: Which interval to choose for forcesaving. Defaults to `5m`. +- **FORCESAVE_STEP**: Which step to choose for forcesaving. Defaults to `5m`. - **WOPI_ENABLED**: Specifies the enabling the wopi handlers. Defaults to `false`. - **USE_UNAUTHORIZED_STORAGE**: Set to `true`if using selfsigned certificates for your storage server e.g. Nextcloud. Defaults to `false` - **GENERATE_FONTS**: When 'true' regenerates fonts list and the fonts thumbnails etc. at each start. Defaults to `true` diff --git a/run-document-server.sh b/run-document-server.sh index fd183a318..400e9e27a 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -75,6 +75,10 @@ NGINX_CONFIG_PATH="/etc/nginx/nginx.conf" NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-1} NGINX_WORKER_CONNECTIONS=${NGINX_WORKER_CONNECTIONS:-$(ulimit -n)} +FORCESAVE_ENABLE=${FORCESAVE_ENABLE:-false} +FORCESAVE_INTERVAL=${FORCESAVE_INTERVAL:-5m} +FORCESAVE_STEP=${FORCESAVE_STEP:-1m} + JWT_ENABLED=${JWT_ENABLED:-true} # validate user's vars before usinig in json @@ -328,6 +332,11 @@ update_ds_settings(){ ${JSON} -I -e "this.services.CoAuthoring.token.inbox.inBody = ${JWT_IN_BODY}" ${JSON} -I -e "this.services.CoAuthoring.token.outbox.inBody = ${JWT_IN_BODY}" + ${JSON} -I -e "if(this.services.CoAuthoring.autoAssembly===undefined)this.services.CoAuthoring.autoAssembly={};" + ${JSON} -I -e "this.services.CoAuthoring.autoAssembly.enable = ${FORCESAVE_ENABLE}" + ${JSON} -I -e "this.services.CoAuthoring.autoAssembly.interval = '${FORCESAVE_INTERVAL}'" + ${JSON} -I -e "this.services.CoAuthoring.autoAssembly.step = '${FORCESAVE_STEP}'" + if [ -f "${ONLYOFFICE_EXAMPLE_CONFIG}" ]; then ${JSON_EXAMPLE} -I -e "this.server.token.enable = ${JWT_ENABLED}" ${JSON_EXAMPLE} -I -e "this.server.token.secret = '${JWT_SECRET}'"