From 143e77fdfcc3b6e462ca62b19fb8edfb81c37b49 Mon Sep 17 00:00:00 2001
From: Danil Titarenko <77471369+danilapog@users.noreply.github.com>
Date: Mon, 18 Jul 2022 17:11:06 +0300
Subject: [PATCH] Fix Big #57286 / Add redis password config settings (#466)

* Add redis password settings

* Add variable description

* Change variable descriptions

* Change variable descriptions

* Change variable descriptions
---
 README.md              | 1 +
 run-document-server.sh | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/README.md b/README.md
index a7bc84d..5020dfd 100644
--- a/README.md
+++ b/README.md
@@ -185,6 +185,7 @@ Below is the complete list of parameters that can be set using environment varia
 - **AMQP_TYPE**: The message broker type. Supported values are `rabbitmq` or `activemq`. Defaults to `rabbitmq`.
 - **REDIS_SERVER_HOST**: The IP address or the name of the host where the Redis server is running.
 - **REDIS_SERVER_PORT**:  The Redis server port number.
+- **REDIS_SERVER_PASS**: The Redis server password. The password is not set by default.
 - **NGINX_WORKER_PROCESSES**: Defines the number of nginx worker processes.
 - **NGINX_WORKER_CONNECTIONS**: Sets the maximum number of simultaneous connections that can be opened by a nginx worker process.
 - **SECURE_LINK_SECRET**: Defines secret for the nginx config directive [secure_link_md5](http://nginx.org/ru/docs/http/ngx_http_secure_link_module.html#secure_link_md5). Defaults to `random string`.
diff --git a/run-document-server.sh b/run-document-server.sh
index 2b2e386..0ae0764 100755
--- a/run-document-server.sh
+++ b/run-document-server.sh
@@ -300,6 +300,11 @@ update_redis_settings(){
   ${JSON} -I -e "if(this.services.CoAuthoring.redis===undefined)this.services.CoAuthoring.redis={};"
   ${JSON} -I -e "this.services.CoAuthoring.redis.host = '${REDIS_SERVER_HOST}'"
   ${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
+
+  if [ -n "${REDIS_SERVER_PASS}" ]; then
+    ${JSON} -I -e "this.services.CoAuthoring.redis.options = {'password':'${REDIS_SERVER_PASS}'}"
+  fi
+
 }
 
 update_ds_settings(){