Files
notifications-api/app/cloudfoundry_config.py
Leo Hemsted 0457850fc0 Remove redundant conditional for CF Redis
This is now used in all environments and we've removed support for
non-CF Redis.
2022-04-20 11:41:33 +01:00

13 lines
471 B
Python

import json
import os
def extract_cloudfoundry_config():
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
# Postgres config
os.environ['SQLALCHEMY_DATABASE_URI'] = vcap_services['postgres'][0]['credentials']['uri'].replace('postgres',
'postgresql')
# Redis config
os.environ['REDIS_URL'] = vcap_services['redis'][0]['credentials']['uri']