Files
notifications-api/app/cloudfoundry_config.py

13 lines
485 B
Python
Raw Normal View History

2016-12-08 12:12:45 +00:00
import json
2021-03-10 13:55:06 +00:00
import os
2016-12-08 12:12:45 +00:00
def extract_cloudfoundry_config():
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
# Postgres config
2022-06-17 16:46:20 -04:00
os.environ['SQLALCHEMY_DATABASE_URI'] = vcap_services['aws-rds'][0]['credentials']['uri'].replace('postgres',
'postgresql')
# Redis config
2022-06-17 16:46:20 -04:00
os.environ['REDIS_URL'] = vcap_services['aws-elasticache-redis'][0]['credentials']['uri']