Skip to content

Commit 1475242

Browse files
committed
adding config props
1 parent b5972e7 commit 1475242

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ services:
3535
mongo-db:
3636
container_name: mongo-db
3737
image: mongo:4.0
38+
ports:
39+
- 27017:27017
3840
networks:
3941
- openhim
4042
restart: unless-stopped

src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express from 'express';
22
import path from 'path';
3+
import { readFile } from 'fs/promises';
34
import { getConfig } from './config/config';
45
import logger from './logger';
56
import routes from './routes/index';
@@ -14,7 +15,7 @@ app.use('/', routes);
1415

1516
createMinioBucketListeners();
1617

17-
app.listen(getConfig().port, () => {
18+
app.listen(getConfig().port, async() => {
1819
logger.info(`Server is running on port - ${getConfig().port}`);
1920

2021
if (getConfig().runningMode !== 'testing' && getConfig().registerMediator) {

src/openhim/mediatorConfig.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"routes": [
1111
{
1212
"name": "Climate Mediator Endpoint",
13-
"host": "climate-mediator",
13+
"host": "172.17.0.1",
1414
"port": "3000",
1515
"primary": true,
1616
"type": "http"
@@ -28,12 +28,22 @@
2828
"endpoints": [
2929
{
3030
"name": "Climate Endpoint",
31-
"host": "climate-mediator",
31+
"host": "172.17.0.1",
3232
"path": "/test",
3333
"port": "3000",
3434
"primary": true,
3535
"type": "http"
3636
}
3737
],
38-
"configDefs": []
38+
"configDefs": [{
39+
"param": "minio_buckets_registry",
40+
"displayName": "Minio Buckets Registry",
41+
"description": "The available Minio buckets and their configurations",
42+
"type": "struct",
43+
"array": true,
44+
"template":[{
45+
"param": "bucket",
46+
"type": "string"
47+
}]
48+
}]
3949
}

src/openhim/openhim.ts

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export const setupMediator = (mediatorConfigFilePath: string) => {
5353
emitter.on('error', (err: Error) => {
5454
logger.error(`Heartbeat failed: ${JSON.stringify(err)}`);
5555
});
56+
57+
emitter.on('config', (config: any) => {
58+
logger.info(`Config: ${JSON.stringify(config)}`);
59+
});
5660
});
5761
});
5862
} catch (err) {

0 commit comments

Comments
 (0)