Skip to content

Commit

Permalink
Merge pull request #1377 from beehyv/HLM-912
Browse files Browse the repository at this point in the history
HLM-912 | Removing hardcoded facility country code
  • Loading branch information
prasanna-egov committed Dec 22, 2022
2 parents 6472e30 + bd23124 commit 7e2b265
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ MOSIP_IDA_CERT_KEY="-----BEGIN CERTIFICATE-----\nMIIFcDCCA1gCCQDImfyNShfG0DANBgk
MOSIP_MISP_LICENSE_KEY=fyNShfG0DANBgkqhkiG9w0BAQsFADB6MQswCQYDVQQGEwJJT
MOSIP_PARTNER_ID=divoc
MOSIP_PARTNER_API_KEY=123456
NOTIFY_TOPIC='notify'
NOTIFY_TOPIC='notify'
FACILITY_COUNTRY_CODE='IN'
4 changes: 3 additions & 1 deletion backend/certificate_api/configs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ETCD_AUTH_ENABLED = process.env.ETCD_AUTH_ENABLED === "true"
const ETCD_USERNAME = process.env.ETCD_USERNAME;
const ETCD_PASSWORD = process.env.ETCD_PASSWORD;
const ENTITY_TYPES = process.env.ENTITY_TYPES;
const FACILITY_COUNTRY_CODE = process.env.FACILITY_COUNTRY_CODE || '';
module.exports = {
REGISTRY_URL,
JWT_PUBLIC_KEY,
Expand All @@ -36,5 +37,6 @@ module.exports = {
ETCD_AUTH_ENABLED,
ETCD_USERNAME,
ETCD_PASSWORD,
ENTITY_TYPES
ENTITY_TYPES,
FACILITY_COUNTRY_CODE
};
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const convertCertificateToDCCPayload = async(certificateRaw, nameDetails) => {
}

function getAlpha2CodeForCountry(addressCountry) {
return getAlpha2CodeFromAlpha3(addressCountry) || getAlpha2CodeFromName(addressCountry) || getAlpha2CodeIfValid(addressCountry) || 'IN';
return getAlpha2CodeFromAlpha3(addressCountry) || getAlpha2CodeFromName(addressCountry) || getAlpha2CodeIfValid(addressCountry) || config.FACILITY_COUNTRY_CODE;
}

function getAlpha2CodeFromAlpha3(addressCountry) {
Expand Down
1 change: 1 addition & 0 deletions backend/certificate_api/tests/certificate_service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const config = require('../configs/config');
const constants = require('../configs/constants');
config.DISEASE_CODE = 'COVID-19';
config.PUBLIC_HEALTH_AUTHORITY = 'Govt Of India';
config.FACILITY_COUNTRY_CODE='IN';
config.ETCD_URL = 'etcd:2379'
var mockConstructor = {
getObject: jest.fn().mockImplementation((args) => {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ services:
CONFIGURATION_LAYER: "etcd"
ETCD_USERNAME: $ETCD_USERNAME
ETCD_PASSWORD: $ETCD_PASSWORD
FACILITY_COUNTRY_CODE: $FACILITY_COUNTRY_CODE
depends_on:
kafka:
condition: service_healthy
Expand Down

0 comments on commit 7e2b265

Please sign in to comment.