Skip to content

Commit

Permalink
refactor: route through app gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
rajohnson90 committed Nov 7, 2024
1 parent 7977f32 commit 0066a6d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 8 additions & 1 deletion backend/ops_api/ops/document/azure_document_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ def generate_account_sas_url(account_name, account_key, expiry_hours=1):
)

# Construct the SAS URL
sas_url = f"https://{account_name}.blob.core.windows.net/?{sas_token}"
DEFAULT_DEV_OPS_URL = "https://dev.ops.opre.acf.gov"
OPS_URL = (
DEFAULT_DEV_OPS_URL
if "localhost" in current_app.config.get("OPS_FRONTEND_URL")
else current_app.config.get("OPS_FRONTEND_URL")
)
# https://dev.ops.opre.acf.gov/?{sas_token} in dev
sas_url = f"{OPS_URL}/?{sas_token}"
return sas_url

except SasUrlGenerationError as e:
Expand Down
7 changes: 1 addition & 6 deletions backend/ops_api/ops/document/document_gateway.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from flask import Config
from flask_jwt_extended import current_user

from ops_api.ops.document.azure_document_repository import AzureDocumentRepository
from ops_api.ops.document.document_repository import DocumentRepository
Expand All @@ -16,11 +15,7 @@ def __init__(self, config: Config) -> None:
# Validate and register providers with the factory
self.register_providers()

# Select provider based on the current user
if current_user.id >= 500: # Users with id 5xx are test users
self.provider = DocumentProviders.fake.name
else:
self.provider = DocumentProviders.azure.name
self.provider = DocumentProviders.azure.name

def register_providers(self) -> None:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DOCUMENT_TYPES = [

export const VALID_EXTENSIONS = ["pdf", "doc", "docx", "xls", "xlsx"];

export const DOCUMENT_CONTAINER_NAME = "documents";
export const DOCUMENT_CONTAINER_NAME = "docs";

export const ALLOWED_FAKE_HOSTS = "FakeDocumentRepository";
export const ALLOWED_HOSTS = "blob.core.windows.net";
export const ALLOWED_HOSTS = "ops.opre.acf.gov";

0 comments on commit 0066a6d

Please sign in to comment.