settings: Add option to set remote postgres port.

This commit is contained in:
Vishnu KS
2019-12-12 15:18:49 +05:30
committed by Tim Abbott
parent f3c224058f
commit 8b57e39c7e
4 changed files with 6 additions and 1 deletions

View File

@@ -73,6 +73,8 @@ try:
from django.conf import settings from django.conf import settings
if settings.REMOTE_POSTGRES_HOST != '': if settings.REMOTE_POSTGRES_HOST != '':
pg_args['host'] = settings.REMOTE_POSTGRES_HOST pg_args['host'] = settings.REMOTE_POSTGRES_HOST
if settings.REMOTE_POSTGRES_PORT != '':
pg_args['port'] = settings.REMOTE_POSTGRES_PORT
USING_PGROONGA = settings.USING_PGROONGA USING_PGROONGA = settings.USING_PGROONGA
except ImportError: except ImportError:
# process_fts_updates also supports running locally on a remote # process_fts_updates also supports running locally on a remote

View File

@@ -113,6 +113,7 @@ RABBITMQ_USERNAME = 'zulip'
REDIS_HOST = '127.0.0.1' REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379 REDIS_PORT = 6379
REMOTE_POSTGRES_HOST = '' REMOTE_POSTGRES_HOST = ''
REMOTE_POSTGRES_PORT = ''
REMOTE_POSTGRES_SSLMODE = '' REMOTE_POSTGRES_SSLMODE = ''
THUMBOR_URL = '' THUMBOR_URL = ''
THUMBOR_SERVES_CAMO = False THUMBOR_SERVES_CAMO = False

View File

@@ -393,12 +393,13 @@ ENABLE_GRAVATAR = True
#DEFAULT_AVATAR_URI = '/local-static/default-avatar.png' #DEFAULT_AVATAR_URI = '/local-static/default-avatar.png'
# To access an external postgres database you should define the host name in # To access an external postgres database you should define the host name in
# REMOTE_POSTGRES_HOST, you can define the password in the secrets file in the # REMOTE_POSTGRES_HOST, port in REMOTE_POSTGRES_PORT, password in the secrets file in the
# property postgres_password, and the SSL connection mode in REMOTE_POSTGRES_SSLMODE # property postgres_password, and the SSL connection mode in REMOTE_POSTGRES_SSLMODE
# Valid values for REMOTE_POSTGRES_SSLMODE are documented in the # Valid values for REMOTE_POSTGRES_SSLMODE are documented in the
# "SSL Mode Descriptions" table in # "SSL Mode Descriptions" table in
# https://www.postgresql.org/docs/9.5/static/libpq-ssl.html # https://www.postgresql.org/docs/9.5/static/libpq-ssl.html
#REMOTE_POSTGRES_HOST = 'dbserver.example.com' #REMOTE_POSTGRES_HOST = 'dbserver.example.com'
#REMOTE_POSTGRES_PORT = '5432'
#REMOTE_POSTGRES_SSLMODE = 'require' #REMOTE_POSTGRES_SSLMODE = 'require'
# If you want to set a Terms of Service for your server, set the path # If you want to set a Terms of Service for your server, set the path

View File

@@ -282,6 +282,7 @@ if DEVELOPMENT:
elif REMOTE_POSTGRES_HOST != '': elif REMOTE_POSTGRES_HOST != '':
DATABASES['default'].update({ DATABASES['default'].update({
'HOST': REMOTE_POSTGRES_HOST, 'HOST': REMOTE_POSTGRES_HOST,
'PORT': REMOTE_POSTGRES_PORT
}) })
if get_secret("postgres_password") is not None: if get_secret("postgres_password") is not None:
DATABASES['default'].update({ DATABASES['default'].update({