mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 12:09:20 -04:00
Add route secret key header to the API requests
Currently requests to the API made from the admin app are going from PaaS admin app to the nginx router ELB, which then routes them back to the api app on PaaS. This makes sense for external requests, but for requests made from the admin app we could skip nginx and go directly to the api PaaS host, which should reduce load on the nginx instances and potentially reduce latency of the api requests. API apps on PaaS are checking the X-Custom-Forwarder header (which is set by nginx on proxy_pass requests) to only allow requests going through the proxy. This adds the custom header to the API client requests, so that they can pass that header check without going through nginx.
This commit is contained in:
committed by
Chris Hill-Scott
parent
aae94c8c80
commit
acfe8092fc
@@ -10,11 +10,6 @@ class ApiKeyApiClient(NotifyAdminAPIClient):
|
||||
def __init__(self):
|
||||
super().__init__("a" * 73, "b")
|
||||
|
||||
def init_app(self, app):
|
||||
self.base_url = app.config['API_HOST_NAME']
|
||||
self.service_id = app.config['ADMIN_CLIENT_USER_NAME']
|
||||
self.api_key = app.config['ADMIN_CLIENT_SECRET']
|
||||
|
||||
def get_api_keys(self, service_id, key_id=None):
|
||||
if key_id:
|
||||
return self.get(url='/service/{}/api-keys/{}'.format(service_id, key_id))
|
||||
|
||||
Reference in New Issue
Block a user