From c647d39732752ad2b685e114cca6541502841838 Mon Sep 17 00:00:00 2001 From: drono Date: Tue, 30 Jul 2024 12:18:24 +0300 Subject: [PATCH 1/5] add environment variable that will be used by apps to override the url placeholder --- fhir-ig-importer/importer/volume/ig-importer-app.json | 2 +- fhir-ig-importer/package-metadata.json | 3 ++- kafka-mapper-consumer/consumer-ui-app.json | 2 +- kafka-mapper-consumer/package-metadata.json | 3 ++- reprocess-mediator/package-metadata.json | 4 ++-- reprocess-mediator/reprocess-ui-app.json | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fhir-ig-importer/importer/volume/ig-importer-app.json b/fhir-ig-importer/importer/volume/ig-importer-app.json index 4517c9b8..b4336fba 100644 --- a/fhir-ig-importer/importer/volume/ig-importer-app.json +++ b/fhir-ig-importer/importer/volume/ig-importer-app.json @@ -3,7 +3,7 @@ "description": "FHIR IG microfrontend app", "category": "HIE Configuration", "type": "esmodule", - "url": "https://openhimconsole./fhir-ig-importer", + "url": "/fhir-ig-importer", "showInPortal": true, "showInSideBar": true, "access_roles": ["admin"], diff --git a/fhir-ig-importer/package-metadata.json b/fhir-ig-importer/package-metadata.json index 1bc5473f..e8c440e1 100644 --- a/fhir-ig-importer/package-metadata.json +++ b/fhir-ig-importer/package-metadata.json @@ -15,6 +15,7 @@ "FHIR_IG_IMPORTER_CORE_HOST": "0.0.0.0", "FHIR_IG_IMPORTER_CORE_URL": "http://0.0.0.0:3001/fhir/ig/v1.0", "FHIR_IG_IMPORTER_UI_VERSION": "latest", - "FHIR_IG_IMPORTER_CORE_VERSION": "latest" + "FHIR_IG_IMPORTER_CORE_VERSION": "latest", + "OPENHIM_CONSOLE_URL": "http://localhost:9000" } } diff --git a/kafka-mapper-consumer/consumer-ui-app.json b/kafka-mapper-consumer/consumer-ui-app.json index b6ac02d7..b02b2bec 100644 --- a/kafka-mapper-consumer/consumer-ui-app.json +++ b/kafka-mapper-consumer/consumer-ui-app.json @@ -3,7 +3,7 @@ "description": "Kafka mapper consumer microfrontends app", "category": "HIE Configuration", "type": "esmodule", - "url": "http://localhost:8091/jembi-kafka-mapper-consumer-ui.js", + "url": "/jembi-kafka-mapper-consumer-ui.js", "showInPortal": true, "showInSideBar": false, "access_roles": ["admin"], diff --git a/kafka-mapper-consumer/package-metadata.json b/kafka-mapper-consumer/package-metadata.json index 0c0b17a9..f40c4ac3 100644 --- a/kafka-mapper-consumer/package-metadata.json +++ b/kafka-mapper-consumer/package-metadata.json @@ -18,6 +18,7 @@ "CLICKHOUSE_HOST": "analytics-datastore-clickhouse", "CLICKHOUSE_PORT": "8123", "KAFKA_CONSUMER_MAPPER_MEDIATOR_VERSION": "jembi/kafka-mapper-consumer:v0.0.1", - "KAFKA_CONSUMER_MAPPER_UI_VERSION": "jembi/kafka-mapper-consumer-ui:v0.0.1" + "KAFKA_CONSUMER_MAPPER_UI_VERSION": "jembi/kafka-mapper-consumer-ui:v0.0.1", + "OPENHIM_CONSOLE_URL": "http://localhost:9000" } } diff --git a/reprocess-mediator/package-metadata.json b/reprocess-mediator/package-metadata.json index fa8c999d..98567a65 100644 --- a/reprocess-mediator/package-metadata.json +++ b/reprocess-mediator/package-metadata.json @@ -15,7 +15,7 @@ "REPROCESS_MEDIATOR_VERSION": "jembi/reprocess-mediator:v0.1.0", "REPROCESS_MEDIATOR_UI_VERSION": "jembi/reprocess-mediator-ui:v0.1.0", "MONGODB_CONNECTION_STRING": "mongodb://mongo-1:27017/openhim", - "MONGODB_DIRECT_CONNECTION": false - + "MONGODB_DIRECT_CONNECTION": false, + "OPENHIM_CONSOLE_URL": "http://localhost:9000" } } diff --git a/reprocess-mediator/reprocess-ui-app.json b/reprocess-mediator/reprocess-ui-app.json index 840b037b..98997eff 100644 --- a/reprocess-mediator/reprocess-ui-app.json +++ b/reprocess-mediator/reprocess-ui-app.json @@ -3,7 +3,7 @@ "description": "Reprocess microfrontends app", "category": "HIE Configuration", "type": "esmodule", - "url": "http://localhost:3030/jembi-reprocessor-mediator-microfrontend.js", + "url": "/jembi-reprocessor-mediator-microfrontend.js", "showInPortal": true, "showInSideBar": false, "access_roles": ["admin"], From 449b9c14d16a5da3e9cd6757ce03b002a7bf7fc5 Mon Sep 17 00:00:00 2001 From: drono Date: Tue, 30 Jul 2024 14:20:06 +0300 Subject: [PATCH 2/5] Add env variable and modify the registration script --- fhir-ig-importer/importer/docker-compose.config.yml | 1 + fhir-ig-importer/importer/volume/openhimConfig.js | 10 ++++++++++ fhir-ig-importer/package-metadata.json | 2 +- interoperability-layer-openhim/package-metadata.json | 2 +- kafka-mapper-consumer/consumer-ui-app.json | 2 +- kafka-mapper-consumer/docker-compose.config.yml | 1 + kafka-mapper-consumer/openhimConfig.js | 10 ++++++++++ kafka-mapper-consumer/package-metadata.json | 6 +++--- reprocess-mediator/docker-compose.config.yml | 1 + reprocess-mediator/openhimConfig.js | 9 +++++++++ reprocess-mediator/package-metadata.json | 6 +++--- reprocess-mediator/reprocess-ui-app.json | 2 +- 12 files changed, 42 insertions(+), 10 deletions(-) diff --git a/fhir-ig-importer/importer/docker-compose.config.yml b/fhir-ig-importer/importer/docker-compose.config.yml index 0d11921a..3447da3b 100644 --- a/fhir-ig-importer/importer/docker-compose.config.yml +++ b/fhir-ig-importer/importer/docker-compose.config.yml @@ -12,6 +12,7 @@ services: OPENHIM_API_PASSWORD: ${OPENHIM_PASSWORD} # Reject unauthorised is only needed if the OpenHIM's SSL is not setup NODE_TLS_REJECT_UNAUTHORIZED: 0 + OPENHIM_CONSOLE_BASE_URL: ${OPENHIM_CONSOLE_BASE_URL} command: sh -c "node openhimConfig.js" configs: - source: fhir-ig-importer-config-importer-openhimConfig.js diff --git a/fhir-ig-importer/importer/volume/openhimConfig.js b/fhir-ig-importer/importer/volume/openhimConfig.js index cae7a270..56723f57 100644 --- a/fhir-ig-importer/importer/volume/openhimConfig.js +++ b/fhir-ig-importer/importer/volume/openhimConfig.js @@ -43,6 +43,16 @@ const appJsonData = JSON.parse( fs.readFileSync(path.resolve(__dirname, "ig-importer-app.json")) ); +//Substitute the url with environ variable + +let url = appJsonData.url; +let newUrl = url.replace( + "", + process.env.OPENHIM_CONSOLE_BASE_URL +); + +appJsonData.url = newUrl; + const data = JSON.stringify(jsonData); const appData = JSON.stringify(appJsonData); diff --git a/fhir-ig-importer/package-metadata.json b/fhir-ig-importer/package-metadata.json index e8c440e1..8f901077 100644 --- a/fhir-ig-importer/package-metadata.json +++ b/fhir-ig-importer/package-metadata.json @@ -16,6 +16,6 @@ "FHIR_IG_IMPORTER_CORE_URL": "http://0.0.0.0:3001/fhir/ig/v1.0", "FHIR_IG_IMPORTER_UI_VERSION": "latest", "FHIR_IG_IMPORTER_CORE_VERSION": "latest", - "OPENHIM_CONSOLE_URL": "http://localhost:9000" + "OPENHIM_CONSOLE_BASE_URL": "http://localhost:9000" } } diff --git a/interoperability-layer-openhim/package-metadata.json b/interoperability-layer-openhim/package-metadata.json index 1fa38624..0e47bdee 100644 --- a/interoperability-layer-openhim/package-metadata.json +++ b/interoperability-layer-openhim/package-metadata.json @@ -44,7 +44,7 @@ "KC_OPENHIM_ROOT_URL": "http://localhost:9000", "KC_API_URL": "http://identity-access-manager-keycloak:8080", "OPENHIM_SUBDOMAIN": "openhim", - "OPENHIM_CONSOLE_BASE_URL": "localhost:9000", + "OPENHIM_CONSOLE_BASE_URL": "http://localhost:9000", "OPENHIM_API_HOST": "localhost", "OPENHIM_API_PORT": "5001" } diff --git a/kafka-mapper-consumer/consumer-ui-app.json b/kafka-mapper-consumer/consumer-ui-app.json index b02b2bec..42d47345 100644 --- a/kafka-mapper-consumer/consumer-ui-app.json +++ b/kafka-mapper-consumer/consumer-ui-app.json @@ -3,7 +3,7 @@ "description": "Kafka mapper consumer microfrontends app", "category": "HIE Configuration", "type": "esmodule", - "url": "/jembi-kafka-mapper-consumer-ui.js", + "url": "/kafka-mapper-consumer-ui", "showInPortal": true, "showInSideBar": false, "access_roles": ["admin"], diff --git a/kafka-mapper-consumer/docker-compose.config.yml b/kafka-mapper-consumer/docker-compose.config.yml index 2e1b4db5..dd13d684 100644 --- a/kafka-mapper-consumer/docker-compose.config.yml +++ b/kafka-mapper-consumer/docker-compose.config.yml @@ -12,6 +12,7 @@ services: OPENHIM_API_PASSWORD: ${OPENHIM_PASSWORD} # Reject unauthorised is only needed if the OpenHIM's SSL is not setup NODE_TLS_REJECT_UNAUTHORIZED: 0 + OPENHIM_CONSOLE_BASE_URL: ${OPENHIM_CONSOLE_BASE_URL} command: sh -c "node openhimConfig.js" configs: - source: kafka-mapper-consumer-openhimConfig.js diff --git a/kafka-mapper-consumer/openhimConfig.js b/kafka-mapper-consumer/openhimConfig.js index a7868cde..149e6ee3 100644 --- a/kafka-mapper-consumer/openhimConfig.js +++ b/kafka-mapper-consumer/openhimConfig.js @@ -37,6 +37,16 @@ function makeRequest(options, data) { const appJsonData = JSON.parse( fs.readFileSync(path.resolve(__dirname, "consumer-ui-app.json")) ); +//Substitute the url with environ variable + +let url = appJsonData.url; +let newUrl = url.replace( + "", + process.env.OPENHIM_CONSOLE_BASE_URL +); + +appJsonData.url = newUrl; + const appData = JSON.stringify(appJsonData); const options = { diff --git a/kafka-mapper-consumer/package-metadata.json b/kafka-mapper-consumer/package-metadata.json index f40c4ac3..9fa23ea9 100644 --- a/kafka-mapper-consumer/package-metadata.json +++ b/kafka-mapper-consumer/package-metadata.json @@ -17,8 +17,8 @@ "REGISTER_MEDIATOR": "true", "CLICKHOUSE_HOST": "analytics-datastore-clickhouse", "CLICKHOUSE_PORT": "8123", - "KAFKA_CONSUMER_MAPPER_MEDIATOR_VERSION": "jembi/kafka-mapper-consumer:v0.0.1", - "KAFKA_CONSUMER_MAPPER_UI_VERSION": "jembi/kafka-mapper-consumer-ui:v0.0.1", - "OPENHIM_CONSOLE_URL": "http://localhost:9000" + "KAFKA_CONSUMER_MAPPER_MEDIATOR_VERSION": "jembi/kafka-mapper-consumer:latest", + "KAFKA_CONSUMER_MAPPER_UI_VERSION": "jembi/kafka-mapper-consumer-ui:latest", + "OPENHIM_CONSOLE_BASE_URL": "http://localhost:9000" } } diff --git a/reprocess-mediator/docker-compose.config.yml b/reprocess-mediator/docker-compose.config.yml index 1135b51e..6ed5fbb8 100644 --- a/reprocess-mediator/docker-compose.config.yml +++ b/reprocess-mediator/docker-compose.config.yml @@ -12,6 +12,7 @@ services: OPENHIM_API_PASSWORD: ${OPENHIM_PASSWORD} # Reject unauthorised is only needed if the OpenHIM's SSL is not setup NODE_TLS_REJECT_UNAUTHORIZED: 0 + OPENHIM_CONSOLE_BASE_URL: ${OPENHIM_CONSOLE_BASE_URL} command: sh -c "node openhimConfig.js" configs: - source: reprocess-openhimConfig.js diff --git a/reprocess-mediator/openhimConfig.js b/reprocess-mediator/openhimConfig.js index e5268dd9..f1c8781b 100644 --- a/reprocess-mediator/openhimConfig.js +++ b/reprocess-mediator/openhimConfig.js @@ -37,6 +37,15 @@ function makeRequest(options, data) { const appJsonData = JSON.parse( fs.readFileSync(path.resolve(__dirname, "reprocess-ui-app.json")) ); +//Substitute the url with environ variable + +let url = appJsonData.url; +let newUrl = url.replace( + "", + process.env.OPENHIM_CONSOLE_BASE_URL +); + +appJsonData.url = newUrl; const appData = JSON.stringify(appJsonData); const options = { diff --git a/reprocess-mediator/package-metadata.json b/reprocess-mediator/package-metadata.json index 98567a65..049d2e32 100644 --- a/reprocess-mediator/package-metadata.json +++ b/reprocess-mediator/package-metadata.json @@ -12,10 +12,10 @@ "OPENHIM_PASSWORD": "instant101", "REGISTER_MEDIATOR": "true", "REPROCESSOR_API_BASE_URL": "http://reprocess-mediator:3000", - "REPROCESS_MEDIATOR_VERSION": "jembi/reprocess-mediator:v0.1.0", - "REPROCESS_MEDIATOR_UI_VERSION": "jembi/reprocess-mediator-ui:v0.1.0", + "REPROCESS_MEDIATOR_VERSION": "jembi/reprocess-mediator:latest", + "REPROCESS_MEDIATOR_UI_VERSION": "jembi/reprocess-mediator-ui:latest", "MONGODB_CONNECTION_STRING": "mongodb://mongo-1:27017/openhim", "MONGODB_DIRECT_CONNECTION": false, - "OPENHIM_CONSOLE_URL": "http://localhost:9000" + "OPENHIM_CONSOLE_BASE_URL": "http://localhost:9000" } } diff --git a/reprocess-mediator/reprocess-ui-app.json b/reprocess-mediator/reprocess-ui-app.json index 98997eff..f89da247 100644 --- a/reprocess-mediator/reprocess-ui-app.json +++ b/reprocess-mediator/reprocess-ui-app.json @@ -3,7 +3,7 @@ "description": "Reprocess microfrontends app", "category": "HIE Configuration", "type": "esmodule", - "url": "/jembi-reprocessor-mediator-microfrontend.js", + "url": "/reprocess-mediator-ui", "showInPortal": true, "showInSideBar": false, "access_roles": ["admin"], From 04b4e38aa6fa0a02e450993f4d14bbee08cbe5e9 Mon Sep 17 00:00:00 2001 From: Drizzentic Date: Wed, 31 Jul 2024 09:20:06 +0300 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- fhir-ig-importer/importer/volume/openhimConfig.js | 4 +++- kafka-mapper-consumer/openhimConfig.js | 6 +++++- reprocess-mediator/openhimConfig.js | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fhir-ig-importer/importer/volume/openhimConfig.js b/fhir-ig-importer/importer/volume/openhimConfig.js index 56723f57..4a9b2ceb 100644 --- a/fhir-ig-importer/importer/volume/openhimConfig.js +++ b/fhir-ig-importer/importer/volume/openhimConfig.js @@ -46,13 +46,15 @@ const appJsonData = JSON.parse( //Substitute the url with environ variable let url = appJsonData.url; +if (!process.env.OPENHIM_CONSOLE_BASE_URL) { + throw new Error("Environment variable OPENHIM_CONSOLE_BASE_URL is not set"); +} let newUrl = url.replace( "", process.env.OPENHIM_CONSOLE_BASE_URL ); appJsonData.url = newUrl; - const data = JSON.stringify(jsonData); const appData = JSON.stringify(appJsonData); diff --git a/kafka-mapper-consumer/openhimConfig.js b/kafka-mapper-consumer/openhimConfig.js index 149e6ee3..c56379df 100644 --- a/kafka-mapper-consumer/openhimConfig.js +++ b/kafka-mapper-consumer/openhimConfig.js @@ -40,13 +40,17 @@ const appJsonData = JSON.parse( //Substitute the url with environ variable let url = appJsonData.url; + +if (!process.env.OPENHIM_CONSOLE_BASE_URL) { + throw new Error("Environment variable OPENHIM_CONSOLE_BASE_URL is not set"); +} + let newUrl = url.replace( "", process.env.OPENHIM_CONSOLE_BASE_URL ); appJsonData.url = newUrl; - const appData = JSON.stringify(appJsonData); const options = { diff --git a/reprocess-mediator/openhimConfig.js b/reprocess-mediator/openhimConfig.js index f1c8781b..d645c501 100644 --- a/reprocess-mediator/openhimConfig.js +++ b/reprocess-mediator/openhimConfig.js @@ -40,6 +40,10 @@ const appJsonData = JSON.parse( //Substitute the url with environ variable let url = appJsonData.url; + +if (!process.env.OPENHIM_CONSOLE_BASE_URL) { + throw new Error("Environment variable OPENHIM_CONSOLE_BASE_URL is not set"); +} let newUrl = url.replace( "", process.env.OPENHIM_CONSOLE_BASE_URL From 94d277f067ee2847ede8de5fe4bde9236e2c10e8 Mon Sep 17 00:00:00 2001 From: drono Date: Wed, 31 Jul 2024 10:18:15 +0300 Subject: [PATCH 4/5] Implement auth mechanism for FHIR IG Importer --- fhir-ig-importer/docker-compose.yml | 2 ++ fhir-ig-importer/package-metadata.json | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fhir-ig-importer/docker-compose.yml b/fhir-ig-importer/docker-compose.yml index c1bca48c..7c87cced 100644 --- a/fhir-ig-importer/docker-compose.yml +++ b/fhir-ig-importer/docker-compose.yml @@ -21,6 +21,8 @@ services: reverse-proxy: environment: FHIR_IG_IMPORTER_CORE_URL: ${FHIR_IG_IMPORTER_CORE_URL} + OPENHIM_API_USERNAME: ${OPENHIM_USERNAME} + OPENHIM_API_PASSWORD: ${OPENHIM_PASSWORD} networks: hapi-fhir: diff --git a/fhir-ig-importer/package-metadata.json b/fhir-ig-importer/package-metadata.json index 1bc5473f..4fb9e408 100644 --- a/fhir-ig-importer/package-metadata.json +++ b/fhir-ig-importer/package-metadata.json @@ -15,6 +15,8 @@ "FHIR_IG_IMPORTER_CORE_HOST": "0.0.0.0", "FHIR_IG_IMPORTER_CORE_URL": "http://0.0.0.0:3001/fhir/ig/v1.0", "FHIR_IG_IMPORTER_UI_VERSION": "latest", - "FHIR_IG_IMPORTER_CORE_VERSION": "latest" + "FHIR_IG_IMPORTER_CORE_VERSION": "latest", + "OPENHIM_API_USERNAME": "root@openhim.org", + "OPENHIM_API_PASSWORD": "instant101" } } From 000c8a41298ae49c2be4b753c1503d9ff8d4752a Mon Sep 17 00:00:00 2001 From: Drizzentic Date: Wed, 31 Jul 2024 10:29:38 +0300 Subject: [PATCH 5/5] Update fhir-ig-importer/package-metadata.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- fhir-ig-importer/package-metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fhir-ig-importer/package-metadata.json b/fhir-ig-importer/package-metadata.json index 4fb9e408..9b4563fd 100644 --- a/fhir-ig-importer/package-metadata.json +++ b/fhir-ig-importer/package-metadata.json @@ -16,7 +16,7 @@ "FHIR_IG_IMPORTER_CORE_URL": "http://0.0.0.0:3001/fhir/ig/v1.0", "FHIR_IG_IMPORTER_UI_VERSION": "latest", "FHIR_IG_IMPORTER_CORE_VERSION": "latest", - "OPENHIM_API_USERNAME": "root@openhim.org", - "OPENHIM_API_PASSWORD": "instant101" + "OPENHIM_API_USERNAME": "", + "OPENHIM_API_PASSWORD": "" } }