import os
import json
from base64 import b64decode


def load_paas_settings():
    paas = {}
    if 'VCAP_SERVICES' in os.environ:
        vcap = json.loads(os.environ['VCAP_SERVICES'])
        if 'mongodb' in vcap:
            for service in vcap['mongodb']:
                if service['name'] == 'gds-performance-platform-mongodb-service':
                    credentials = service['credentials']
                    paas['DATABASE_URL'] = credentials['uri']
                    ca_cert = b64decode(credentials['ca_certificate_base64'])
                    paas['CA_CERTIFICATE'] = ca_cert
        if 'REDIS_DATABASE_NUMBER' in os.environ:
            for service in vcap['user-provided']:
                if service['name'] == 'redis-poc':
                    database_number = os.environ['REDIS_DATABASE_NUMBER']
                    url = service['credentials']['url']
                    url += '/' + database_number
                    paas['REDIS_URL'] = url
    return paas

@@ -672,21 +672,13 @@
 ap%5B'
-user-provided
+redis
 '%5D:%0A
@@ -725,12 +725,8 @@
 edis
--poc
 ':%0A 
@@ -850,17 +850,17 @@
 ls'%5D%5B'ur
-l
+i
 '%5D%0A     

use new redis instead of compose redis