-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconfig.js
58 lines (56 loc) · 2.09 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict'
const {parseStringToBoolean} = require('./util')
exports.getConfig = function () {
return Object.freeze({
port: process.env.SERVER_PORT || 3003,
logLevel: process.env.LOG_LEVEL || 'info',
enableLogging: parseStringToBoolean(process.env.ENABLE_LOGGING, true),
mongoUrl:
process.env.MONGO_URL ||
'mongodb://localhost:27017,localhost:27018,localhost:27019/mapping-mediator?replicaSet=mapper-mongo-set',
openhim: Object.freeze({
apiURL: process.env.OPENHIM_URL || 'https://localhost:8080',
username: process.env.OPENHIM_USERNAME || '[email protected]',
password: process.env.OPENHIM_PASSWORD || 'openhim-password',
trustSelfSigned: parseStringToBoolean(
process.env.TRUST_SELF_SIGNED,
true
),
register: parseStringToBoolean(process.env.OPENHIM_REGISTER, true),
urn: process.env.MEDIATOR_URN || 'urn:mediator:generic_mapper'
}),
parser: Object.freeze({
limit: process.env.PARSER_LIMIT || '1mb',
xmlOptions: {
trim: parseStringToBoolean(process.env.PARSER_XML_OPTIONS_TRIM, true),
explicitRoot: parseStringToBoolean(
process.env.PARSER_XML_OPTIONS_EXPLICIT_ROOT,
false
),
explicitArray: parseStringToBoolean(
process.env.PARSER_XML_OPTIONS_EXPLICIT_ARRAY,
false
)
}
}),
validation: Object.freeze({
nullable: parseStringToBoolean(
process.env.VALIDATION_ACCEPT_NULL_VALUES,
false
),
coerceTypes:
parseStringToBoolean(
process.env.VALIDATION_COERCE_TYPES,
process.env.VALIDATION_COERCE_TYPES
) || false
}),
dynamicEndpoints: parseStringToBoolean(process.env.DYNAMIC_ENDPOINTS, true),
kafkaConfig: {
brokers: process.env.KAFKA_BROKERS || 'localhost:9092',
clientId: process.env.KAFKA_CLIENTID || 'mapping-mediator',
requestTimeout: process.env.KAFKA_REQUEST_TIMEOUT || 60000,
connectionTimeout: process.env.KAFKA_CONNECTION_TIMEOUT || 60000,
groupId: process.env.KAFKA_CONSUMER_GROUPID || 'mapping-mediator'
}
})
}