Skip to content

Commit

Permalink
fix: basic auth credential passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
BoehmDo committed Jan 15, 2025
1 parent 16ab6e1 commit b1b45b3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
18 changes: 18 additions & 0 deletions compose-with-blaze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ services:
environment:
FHIR_SERVER_URL: ${FHIR_SERVER_URL:-http://blaze:8080/fhir/}
FACADE_PORT: ${FACADE_PORT:-8082}
PAGE_SIZE: ${PAGE_SIZE:-50}
PAGE_STORE_TIME: ${PAGE_STORE_TIME:-1200}
PAGING_STORE: ${PAGING_STORE:-LOCAL}
MONGO_DB_URL: ${MONGO_DB_URL:-mongodb://host.docker.internal:27017}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
BA_USER_NAME: ${BA_USER_NAME}
BA_PASSWORD: ${BA_PASSWORD}
PROVISION_CONFIG: ${PROVISION_CONFIG}
RESOURCE_CONFIG: ${RESOURCE_CONFIG}
SSL_CERT: ${SSL_CERT}
SSL_KEY: ${SSL_KEY}
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-1}
PROCESSES_PER_WORKER: ${PROCESSES_PER_WORKER:-1}
MP_CHUNK_SIZE: ${MP_CHUNK_SIZE:-50}
INTERNAL_PAGE_SIZE: ${INTERNAL_PAGE_SIZE:-2000}
CONSENT_CACHE_TIME: ${CONSENT_CACHE_TIME:-60}
env_file:
- .env
ports:
- ${FACADE_PORT:-8082}:8082

Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@ services:
restart: unless-stopped
ports:
- ${FACADE_PORT:-8082}:${FACADE_PORT:-8082}
env_file:
- .env
environment:
FHIR_SERVER_URL: ${FHIR_SERVER_URL}
FACADE_PORT: ${FACADE_PORT:-8082}
PAGE_SIZE: ${PAGE_SIZE:-50}
PAGE_STORE_TIME: ${PAGE_STORE_TIME:-1200}
PAGING_STORE: ${PAGING_STORE:-LOCAL}
MONGO_DB_URL: ${MONGO_DB_URL:-mongodb://host.docker.internal:27017}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
BA_USER_NAME: ${BA_USER_NAME}
BA_PASSWORD: ${BA_PASSWORD}
SSL_CERT: ${SSL_CERT}
SSL_KEY: ${SSL_KEY}
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-1}
PROCESSES_PER_WORKER: ${PROCESSES_PER_WORKER:-1}
MP_CHUNK_SIZE: ${MP_CHUNK_SIZE:-50}
INTERNAL_PAGE_SIZE: ${INTERNAL_PAGE_SIZE:-2000}
CONSENT_CACHE_TIME: ${CONSENT_CACHE_TIME:-60}
RESOURCE_CONFIG: |
Resources:
PlaceholderResource:
Expand Down
12 changes: 11 additions & 1 deletion facade_app/util/consentAndResourceUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from requests.auth import HTTPBasicAuth

LOG_LEVEL = os.environ["LOG_LEVEL"]
BA_USER_NAME = os.getenv("BA_USER_NAME", "")
BA_PASSWORD = os.getenv("BA_PASSWORD", "")


@timeit
Expand All @@ -15,7 +17,15 @@ def getAllConsents(SERVER_URL):

# Initial request and processing
s = requests.session()
auth = HTTPBasicAuth(os.getenv("BA_USER_NAME", ""), os.getenv("BA_PASSWORD", ""))
auth = HTTPBasicAuth(BA_USER_NAME, BA_PASSWORD)
if BA_USER_NAME == "":
print(
"No Basic Auth Username provided. Please provide Basic Auth credentials if required."
)
if BA_PASSWORD == "":
print(
"No Basic Auth Password provided. Please provide Basic Auth credentials if required."
)
params = {"_format": "application/fhir+json"}
headers = {
"Accept": "application/fhir+json",
Expand Down

0 comments on commit b1b45b3

Please sign in to comment.