Refactor database configuration to make ZULIP_COM the special case instead of the default.

(imported from commit bba7a3a78dc4fd0e442503f8707295eabc581652)
This commit is contained in:
Yoyo Zhou 2015-08-21 12:24:34 -07:00 committed by Tim Abbott
parent 8549606eb3
commit 50ccbc4230
1 changed files with 8 additions and 12 deletions

View File

@ -210,30 +210,26 @@ DATABASES = {"default": {
'NAME': 'zulip', 'NAME': 'zulip',
'USER': 'zulip', 'USER': 'zulip',
'PASSWORD': '', # Authentication done via certificates 'PASSWORD': '', # Authentication done via certificates
'HOST': 'postgres.zulip.net', 'HOST': '', # Host = '' => connect through a local socket
'SCHEMA': 'zulip', 'SCHEMA': 'zulip',
'CONN_MAX_AGE': 600, 'CONN_MAX_AGE': 600,
'OPTIONS': { 'OPTIONS': {
'sslmode': 'verify-full',
'connection_factory': TimeTrackingConnection 'connection_factory': TimeTrackingConnection
}, },
}, },
} }
if VOYAGER: if DEVELOPMENT:
DATABASES["default"].update({
# Host = '' => connect through a local socket
'HOST': '',
'OPTIONS': {
'connection_factory': TimeTrackingConnection
}
})
elif DEVELOPMENT:
LOCAL_DATABASE_PASSWORD = get_secret("local_database_password") LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")
DATABASES["default"].update({ DATABASES["default"].update({
'PASSWORD': LOCAL_DATABASE_PASSWORD, 'PASSWORD': LOCAL_DATABASE_PASSWORD,
'HOST': 'localhost', 'HOST': 'localhost'
})
elif ZULIP_COM:
DATABASES["default"].update({
'HOST': 'postgres.zulip.net',
'OPTIONS': { 'OPTIONS': {
'sslmode': 'verify-full',
'connection_factory': TimeTrackingConnection 'connection_factory': TimeTrackingConnection
} }
}) })