mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-02 16:20:42 -05:00
These env vars can be set directly in the manifest, like we do for
Template Preview [^1].
[^1]: c08036189b/manifest.yml.j2 (L23-L26)
14 lines
508 B
Python
14 lines
508 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
|
|
if 'redis' in vcap_services:
|
|
os.environ['REDIS_URL'] = vcap_services['redis'][0]['credentials']['uri']
|