Skip to content

Commit

Permalink
fix: use environment variables directly from env
Browse files Browse the repository at this point in the history
  • Loading branch information
naftis committed Feb 23, 2024
1 parent 6cb99d7 commit ae40f51
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions packages/api/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
import * as fs from 'fs'
import * as util from 'util'
import { logger } from '@api/logger'

const get = (secret: string) => {
try {
// Swarm secret are accessible within tmpfs /run/secrets dir
return fs
.readFileSync(util.format('/run/secrets/%s', secret), 'utf8')
.trim()
} catch (e) {
return false
}
}

export const HOST = process.env.HOST || '0.0.0.0'
export const PORT = process.env.PORT || 4545
export const WEBHOOK_URL = process.env.WEBHOOK_URL || '' // Insert your webhook URL
export const AUTH_URL = process.env.AUTH_URL || '' // Insert the URL to your OpenCRVS auth service installation
export const CALLBACK_URL = process.env.CALLBACK_URL || '' // Insert your webhooks URL here for Verification Request and Event Notification
export const OPENHIM_MEDIATOR_URL = process.env.OPENHIM_MEDIATOR_URL || '' // Insert your OpenCRVS Country Configuration OpenHIM Mediator URL
export const CLIENT_ID = get('CLIENT_ID') || (process.env.CLIENT_ID as string)
export const CLIENT_SECRET =
get('CLIENT_SECRET') || (process.env.CLIENT_SECRET as string)
export const SHA_SECRET =
get('SHA_SECRET') || (process.env.SHA_SECRET as string)
export const CLIENT_ID = process.env.CLIENT_ID as string
export const CLIENT_SECRET = process.env.CLIENT_SECRET as string
export const SHA_SECRET = process.env.SHA_SECRET as string
export const MOSIP_BIRTH_PROXY_CALLBACK_URL =
process.env.MOSIP_BIRTH_PROXY_CALLBACK_URL || '' // Insert your URL here to which the birth event has to be proxied to
export const MOSIP_DEATH_PROXY_CALLBACK_URL =
Expand Down

0 comments on commit ae40f51

Please sign in to comment.