Refactor: refactoring code

This commit is contained in:
danilapog 2022-07-28 14:05:15 +03:00
parent 48332f0ff9
commit 9388fcbbc0
2 changed files with 10 additions and 8 deletions

View file

@ -51,6 +51,8 @@ services:
- POSTGRES_DB=onlyoffice - POSTGRES_DB=onlyoffice
- POSTGRES_USER=onlyoffice - POSTGRES_USER=onlyoffice
- POSTGRES_HOST_AUTH_METHOD=trust - POSTGRES_HOST_AUTH_METHOD=trust
# NOTE: Comment line POSTGRES_HOST_AUTH_METHOD if you want use access with password.
# Uncomment strings below for use database credentials from secrets.
#- POSTGRES_USER_FILE=/run/secrets/db_username #- POSTGRES_USER_FILE=/run/secrets/db_username
#- POSTGRES_PASSWORD_FILE=/run/secrets/db_password #- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
restart: always restart: always

View file

@ -87,12 +87,12 @@ JWT_SECRET=${JWT_SECRET:-secret}
JWT_HEADER=${JWT_HEADER:-Authorization} JWT_HEADER=${JWT_HEADER:-Authorization}
JWT_IN_BODY=${JWT_IN_BODY:-false} JWT_IN_BODY=${JWT_IN_BODY:-false}
if [ -s ${SECRETS_PATH}/jwt_secret.txt ]; then if [ -s ${SECRETS_PATH}/jwt_secret ]; then
JWT_SECRET=$( cat ${SECRETS_PATH}/jwt_secret.txt ) JWT_SECRET=$( cat ${SECRETS_PATH}/jwt_secret )
fi fi
if [ -s ${SECRETS_PATH}/jwt_header.txt ]; then if [ -s ${SECRETS_PATH}/jwt_header ]; then
JWT_HEADER=$( cat ${SECRETS_PATH}/jwt_header.txt ) JWT_HEADER=$( cat ${SECRETS_PATH}/jwt_header )
fi fi
WOPI_ENABLED=${WOPI_ENABLED:-false} WOPI_ENABLED=${WOPI_ENABLED:-false}
@ -264,13 +264,13 @@ update_db_settings(){
# update db credentials if secrets present # update db credentials if secrets present
if [ -s ${SECRETS_PATH}/db_username.txt ]; then if [ -s ${SECRETS_PATH}/db_username ]; then
SECRET_DB_USER=$( cat ${SECRETS_PATH}/db_username.txt ) SECRET_DB_USER=$( cat ${SECRETS_PATH}/db_username )
${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${SECRET_DB_USER}'" ${JSON} -I -e "this.services.CoAuthoring.sql.dbUser = '${SECRET_DB_USER}'"
fi fi
if [ -s ${SECRETS_PATH}/db_password.txt ]; then if [ -s ${SECRETS_PATH}/db_password ]; then
SECRET_DB_PWD=$( cat {SECRETS_PATH}/db_password.txt ) SECRET_DB_PWD=$( cat ${SECRETS_PATH}/db_password )
${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${SECRET_DB_PWD}'" ${JSON} -I -e "this.services.CoAuthoring.sql.dbPass = '${SECRET_DB_PWD}'"
fi fi
} }