Skip to content

Commit

Permalink
Made the service configurable; to handle backend requests with a serv…
Browse files Browse the repository at this point in the history
…ice token
  • Loading branch information
romanchyla committed Jun 2, 2020
1 parent 518299e commit bf63adb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions biblib/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import current_app


client = lambda: Client(current_app.config).session


Expand Down
4 changes: 2 additions & 2 deletions biblib/views/library_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_documents_from_library(cls, library_id, service_uid):
.format(owner.absolute_uid))

headers = {
'Authorization': request.headers.get('X-Forwarded-Authorization', request.headers.get('Authorization', ''))
'Authorization': current_app.config.get('SERVICE_TOKEN', request.headers.get('X-Forwarded-Authorization', request.headers.get('Authorization', '')))
}
response = client().get(
service,
Expand Down Expand Up @@ -195,7 +195,7 @@ def solr_big_query(

headers = {
'Content-Type': 'big-query/csv',
'Authorization': request.headers.get('X-Forwarded-Authorization', request.headers.get('Authorization', ''))
'Authorization': current_app.config.get('SERVICE_TOKEN', request.headers.get('X-Forwarded-Authorization', request.headers.get('Authorization', '')))
}
current_app.logger.info('Querying Solr bigquery microservice: {0}, {1}'
.format(params,
Expand Down

0 comments on commit bf63adb

Please sign in to comment.