diff --git a/azure_functions/src/functions/caDphTimerTrigger.ts b/azure_functions/src/functions/caDphTimerTrigger.ts index 66c5c641..60e712e9 100644 --- a/azure_functions/src/functions/caDphTimerTrigger.ts +++ b/azure_functions/src/functions/caDphTimerTrigger.ts @@ -13,7 +13,8 @@ export async function caDphTimerTrigger(myTimer: Timer, context: InvocationConte // We set the visibility timeout for the message on reading, in queue.go // messageTimeToLive of -1 means the message does not expire // the queue message contents will (in future) be the key to client-specific config - const sendMessageResponse = await queueClient.sendMessage("cadph", {messageTimeToLive: -1}) + // The message we send here must match the key in config, the scope in report_stream_sender, and the org name in RS + const sendMessageResponse = await queueClient.sendMessage("ca-phl", {messageTimeToLive: -1}) console.log("Sent message successfully, service assigned message Id:", sendMessageResponse.messageId, "service assigned request Id:", sendMessageResponse.requestId ); context.log('Timer function processed request.'); diff --git a/config/local.json b/config/local.json new file mode 100644 index 00000000..94ec769a --- /dev/null +++ b/config/local.json @@ -0,0 +1,8 @@ +{ + "ca-phl": { + "shouldFetch": true + }, + "flexion": { + "shouldFetch": true + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 3a8bf400..5f1138f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,8 +49,10 @@ services: - /bin/sh - -c - | + az storage container create -n config az storage container create -n sftp az storage blob upload --overwrite --account-name devstoreaccount1 --container-name sftp --name import/order_message.hl7 --file mock_data/order_message.hl7 + az storage blob upload --overwrite --account-name devstoreaccount1 --container-name config --name config.json --file config/local.json az storage queue create -n message-import-queue az storage queue create -n message-import-dead-letter-queue az storage queue create -n polling-trigger-queue diff --git a/operations/template/storage.tf b/operations/template/storage.tf index 5a4e49bb..b68a43f2 100644 --- a/operations/template/storage.tf +++ b/operations/template/storage.tf @@ -35,19 +35,25 @@ resource "azurerm_storage_account_customer_managed_key" "storage_storage_account ] //wait for the permission that allows our deployer to write the secret } - resource "azurerm_storage_container" "sftp_container" { name = "sftp" storage_account_name = azurerm_storage_account.storage.name container_access_type = "private" } +// Used in case of event dead letter resource "azurerm_storage_container" "sftp_container_dead_letter" { name = "sftp-dead-letter" storage_account_name = azurerm_storage_account.storage.name container_access_type = "private" } +resource "azurerm_storage_container" "config_container" { + name = "config" + storage_account_name = azurerm_storage_account.storage.name + container_access_type = "private" +} + resource "azurerm_role_assignment" "allow_app_read_write" { scope = azurerm_storage_account.storage.id role_definition_name = "Storage Blob Data Contributor" @@ -70,6 +76,9 @@ resource "azurerm_storage_management_policy" "retention_policy" { filters { blob_types = ["blockBlob", "appendBlob"] + // Only apply the retention policy to the SFTP containers so that we don't delete our config + // Any containers that may contain PHI **must** be included in this prefix_match list + prefix_match = ["sftp/", "sftp-dead-letter/"] } actions {