mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 00:38:25 -04:00
Merge pull request #4213 from alphagov/enable-redis
bind to notify-redis automatically
This commit is contained in:
@@ -4,7 +4,4 @@ import os
|
|||||||
|
|
||||||
def extract_cloudfoundry_config():
|
def extract_cloudfoundry_config():
|
||||||
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
|
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
|
||||||
|
os.environ['REDIS_URL'] = vcap_services['redis'][0]['credentials']['uri']
|
||||||
# Redis config
|
|
||||||
if 'redis' in vcap_services:
|
|
||||||
os.environ['REDIS_URL'] = vcap_services['redis'][0]['credentials']['uri']
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ applications:
|
|||||||
- logit-ssl-syslog-drain
|
- logit-ssl-syslog-drain
|
||||||
- notify-prometheus
|
- notify-prometheus
|
||||||
- notify-splunk
|
- notify-splunk
|
||||||
|
- notify-redis
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NOTIFY_APP_NAME: admin
|
NOTIFY_APP_NAME: admin
|
||||||
@@ -61,6 +62,5 @@ applications:
|
|||||||
TEMPLATE_PREVIEW_API_KEY: '{{ TEMPLATE_PREVIEW_API_KEY }}'
|
TEMPLATE_PREVIEW_API_KEY: '{{ TEMPLATE_PREVIEW_API_KEY }}'
|
||||||
|
|
||||||
REDIS_ENABLED: '{{ REDIS_ENABLED }}'
|
REDIS_ENABLED: '{{ REDIS_ENABLED }}'
|
||||||
REDIS_URL: '{{ REDIS_URL }}'
|
|
||||||
|
|
||||||
NOTIFY_BILLING_DETAILS: '{{ NOTIFY_BILLING_DETAILS | tojson }}'
|
NOTIFY_BILLING_DETAILS: '{{ NOTIFY_BILLING_DETAILS | tojson }}'
|
||||||
|
|||||||
@@ -22,11 +22,3 @@ def test_extract_cloudfoundry_config_populates_other_vars(os_environ, vcap_servi
|
|||||||
extract_cloudfoundry_config()
|
extract_cloudfoundry_config()
|
||||||
|
|
||||||
assert os.environ['REDIS_URL'] == 'redis uri'
|
assert os.environ['REDIS_URL'] == 'redis uri'
|
||||||
|
|
||||||
|
|
||||||
def test_extract_cloudfoundry_config_copes_if_redis_not_set(os_environ, vcap_services):
|
|
||||||
del vcap_services['redis']
|
|
||||||
os.environ['VCAP_SERVICES'] = json.dumps(vcap_services)
|
|
||||||
|
|
||||||
extract_cloudfoundry_config()
|
|
||||||
assert 'REDIS_URL' not in os.environ
|
|
||||||
|
|||||||
Reference in New Issue
Block a user