add new performance-platform section to cf config

it's a new cf-service we've got to create, that contains endpoints
and the bearer tokens for them.
This commit is contained in:
Leo Hemsted
2017-08-23 18:11:44 +01:00
parent 89f4f5173e
commit bd2682b521
4 changed files with 35 additions and 20 deletions

View File

@@ -34,6 +34,8 @@ def set_config_env_vars(vcap_services):
extract_firetext_config(s)
elif s['name'] == 'redis':
extract_redis_config(s)
elif s['name'] == 'performance-platform':
extract_performance_platform_config(s)
def extract_notify_config(notify_config):
@@ -42,10 +44,13 @@ def extract_notify_config(notify_config):
os.environ['ADMIN_CLIENT_SECRET'] = notify_config['credentials']['admin_client_secret']
os.environ['SECRET_KEY'] = notify_config['credentials']['secret_key']
os.environ['DANGEROUS_SALT'] = notify_config['credentials']['dangerous_salt']
os.environ['PERFORMANCE_PLATFORM_TOKEN'] = notify_config['credentials'].get('performance_platform_token', '')
os.environ['SMS_INBOUND_WHITELIST'] = json.dumps(notify_config['credentials']['allow_ip_inbound_sms'])
def extract_performance_platform_config(performance_platform_config):
os.environ['PERFORMANCE_PLATFORM_ENDPOINTS'] = json.dumps(performance_platform_config['credentials'])
def extract_notify_aws_config(aws_config):
os.environ['NOTIFICATION_QUEUE_PREFIX'] = aws_config['credentials']['sqs_queue_prefix']
os.environ['AWS_ACCESS_KEY_ID'] = aws_config['credentials']['aws_access_key_id']

View File

@@ -273,6 +273,10 @@ class Config(object):
SMS_INBOUND_WHITELIST = json.loads(os.environ.get('SMS_INBOUND_WHITELIST', '[]'))
# Format is as follows:
# {"dataset_1": "token_1", ...}
PERFORMANCE_PLATFORM_ENDPOINTS = json.loads(os.environ.get('PERFORMANCE_PLATFORM_ENDPOINTS', '{}'))
######################
# Config overrides ###