Add support for migrating to Redis on PaaS

Similarly to https://github.com/alphagov/notifications-api/pull/3508
This commit is contained in:
Ben Thorner
2022-04-12 16:48:38 +01:00
parent 1bed87b67d
commit 339ca93d9b
2 changed files with 30 additions and 2 deletions

View File

@@ -8,6 +8,12 @@ import os
def extract_cloudfoundry_config():
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
# Redis config
if 'redis' in vcap_services:
os.environ['REDIS_URL'] = vcap_services['redis'][0]['credentials']['uri']
vcap_application = json.loads(os.environ.get('VCAP_APPLICATION'))
os.environ['NOTIFY_ENVIRONMENT'] = vcap_application['space_name']
os.environ['NOTIFY_LOG_PATH'] = '/home/vcap/logs/app.log'