mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 01:02:09 -05:00
Add template preview host url and key to cf config
This commit is contained in:
@@ -36,6 +36,8 @@ def set_config_env_vars(vcap_services):
|
|||||||
extract_redis_config(s)
|
extract_redis_config(s)
|
||||||
elif s['name'] == 'performance-platform':
|
elif s['name'] == 'performance-platform':
|
||||||
extract_performance_platform_config(s)
|
extract_performance_platform_config(s)
|
||||||
|
elif s['name'] == 'notify-template-preview':
|
||||||
|
extract_template_preview_config(s)
|
||||||
|
|
||||||
|
|
||||||
def extract_notify_config(notify_config):
|
def extract_notify_config(notify_config):
|
||||||
@@ -77,3 +79,8 @@ def extract_firetext_config(firetext_config):
|
|||||||
def extract_redis_config(redis_config):
|
def extract_redis_config(redis_config):
|
||||||
os.environ['REDIS_ENABLED'] = redis_config['credentials']['redis_enabled']
|
os.environ['REDIS_ENABLED'] = redis_config['credentials']['redis_enabled']
|
||||||
os.environ['REDIS_URL'] = redis_config['credentials']['redis_url']
|
os.environ['REDIS_URL'] = redis_config['credentials']['redis_url']
|
||||||
|
|
||||||
|
|
||||||
|
def extract_template_preview_config(template_preview_config):
|
||||||
|
os.environ['TEMPLATE_PREVIEW_API_HOST'] = template_preview_config['credentials']['api_host']
|
||||||
|
os.environ['TEMPLATE_PREVIEW_API_KEY'] = template_preview_config['credentials']['api_key']
|
||||||
|
|||||||
@@ -374,6 +374,7 @@ class Test(Config):
|
|||||||
|
|
||||||
SMS_INBOUND_WHITELIST = ['203.0.113.195']
|
SMS_INBOUND_WHITELIST = ['203.0.113.195']
|
||||||
FIRETEXT_INBOUND_SMS_AUTH = ['testkey']
|
FIRETEXT_INBOUND_SMS_AUTH = ['testkey']
|
||||||
|
TEMPLATE_PREVIEW_API_HOST = 'http://localhost:9999'
|
||||||
|
|
||||||
|
|
||||||
class Preview(Config):
|
class Preview(Config):
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ services:
|
|||||||
- notify-aws
|
- notify-aws
|
||||||
- notify-config
|
- notify-config
|
||||||
- notify-db
|
- notify-db
|
||||||
|
- notify-template-preview
|
||||||
- mmg
|
- mmg
|
||||||
- firetext
|
- firetext
|
||||||
- hosted-graphite
|
- hosted-graphite
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ services:
|
|||||||
- notify-aws
|
- notify-aws
|
||||||
- notify-config
|
- notify-config
|
||||||
- notify-db
|
- notify-db
|
||||||
|
- notify-template-preview
|
||||||
- mmg
|
- mmg
|
||||||
- firetext
|
- firetext
|
||||||
- hosted-graphite
|
- hosted-graphite
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ services:
|
|||||||
- notify-aws
|
- notify-aws
|
||||||
- notify-config
|
- notify-config
|
||||||
- notify-db
|
- notify-db
|
||||||
|
- notify-template-preview
|
||||||
- mmg
|
- mmg
|
||||||
- firetext
|
- firetext
|
||||||
- hosted-graphite
|
- hosted-graphite
|
||||||
|
|||||||
@@ -101,6 +101,17 @@ def performance_platform_config():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def template_preview_config():
|
||||||
|
return {
|
||||||
|
'name': 'notify-template-preview',
|
||||||
|
'credentials': {
|
||||||
|
'api_host': 'template-preview api host',
|
||||||
|
'api_key': 'template-preview api key'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def cloudfoundry_config(
|
def cloudfoundry_config(
|
||||||
postgres_config,
|
postgres_config,
|
||||||
@@ -110,7 +121,8 @@ def cloudfoundry_config(
|
|||||||
mmg_config,
|
mmg_config,
|
||||||
firetext_config,
|
firetext_config,
|
||||||
redis_config,
|
redis_config,
|
||||||
performance_platform_config
|
performance_platform_config,
|
||||||
|
template_preview_config
|
||||||
):
|
):
|
||||||
return {
|
return {
|
||||||
'postgres': postgres_config,
|
'postgres': postgres_config,
|
||||||
@@ -121,7 +133,8 @@ def cloudfoundry_config(
|
|||||||
mmg_config,
|
mmg_config,
|
||||||
firetext_config,
|
firetext_config,
|
||||||
redis_config,
|
redis_config,
|
||||||
performance_platform_config
|
performance_platform_config,
|
||||||
|
template_preview_config
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,3 +240,11 @@ def test_performance_platform_config():
|
|||||||
'foo': 'my_token',
|
'foo': 'my_token',
|
||||||
'bar': 'other_token'
|
'bar': 'other_token'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
|
||||||
|
def test_template_preview_config():
|
||||||
|
extract_cloudfoundry_config()
|
||||||
|
|
||||||
|
assert os.environ['TEMPLATE_PREVIEW_API_HOST'] == 'template-preview api host'
|
||||||
|
assert os.environ['TEMPLATE_PREVIEW_API_KEY'] == 'template-preview api key'
|
||||||
|
|||||||
Reference in New Issue
Block a user