mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
separate cbc proxy into separate clients
this is a pretty big and convoluted refactor unfortunately.
Previously:
There was one global `cbc_proxy_client` object in apps. This class has
the information about how to invoke the bt-ee lambda, and handles all
calls to lambda. This includes calls to the canary too (which is a
separate lambda).
The future:
There's one global `cbc_proxy_client`. This knows about the different
provider functions and lambdas, and you'll need to ask this client for a
proxy for your chosen provider. call cbc_proxy_client.get_proxy('ee')`
and it'll return you a proxy that knows what ee's lambda function is,
how to transform any content in a way that is exclusive to ee, and in
future how to parse any response from ee.
The present:
I also cleaned up some duplicate tests.
I'm really not sure about the names of some of these variables - in
particular `cbc_proxy_client` isn't a client - it's more of a java style
factory, where you call a function on it to get the client of your
choice.
This commit is contained in:
@@ -23,7 +23,7 @@ from werkzeug.local import LocalProxy
|
||||
|
||||
from app.celery.celery import NotifyCelery
|
||||
from app.clients import NotificationProviderClients
|
||||
from app.clients.cbc_proxy import CBCProxyClient, CBCProxyNoopClient
|
||||
from app.clients.cbc_proxy import CBCProxyClient
|
||||
from app.clients.document_download import DocumentDownloadClient
|
||||
from app.clients.email.aws_ses import AwsSesClient
|
||||
from app.clients.email.aws_ses_stub import AwsSesStubClient
|
||||
@@ -61,7 +61,7 @@ zendesk_client = ZendeskClient()
|
||||
statsd_client = StatsdClient()
|
||||
redis_store = RedisClient()
|
||||
performance_platform_client = PerformancePlatformClient()
|
||||
cbc_proxy_client = CBCProxyNoopClient()
|
||||
cbc_proxy_client = CBCProxyClient()
|
||||
document_download_client = DocumentDownloadClient()
|
||||
metrics = GDSMetrics()
|
||||
|
||||
@@ -114,9 +114,6 @@ def create_app(application):
|
||||
performance_platform_client.init_app(application)
|
||||
document_download_client.init_app(application)
|
||||
|
||||
global cbc_proxy_client
|
||||
if application.config['CBC_PROXY_AWS_ACCESS_KEY_ID']:
|
||||
cbc_proxy_client = CBCProxyClient()
|
||||
cbc_proxy_client.init_app(application)
|
||||
|
||||
register_blueprint(application)
|
||||
|
||||
Reference in New Issue
Block a user