From 236bf4aa5192cb8fd4661d5ba5f049b03249d741 Mon Sep 17 00:00:00 2001 From: Gerrit Linnemann Date: Mon, 18 Dec 2017 20:20:56 +0100 Subject: [PATCH] Config ausgelagert --- service002/app.js | 6 +++--- service002/config/default.json | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/service002/app.js b/service002/app.js index 41a7bee..55a5669 100644 --- a/service002/app.js +++ b/service002/app.js @@ -16,8 +16,8 @@ app.get('/', (req, res) => res.send('Hello world!')) app.get('/animals/', function (req, res) { var options = { - hostname: '127.0.0.1', - port: 4001, + hostname: config.get('service.001.host'), + port: config.get('service.001.port'), path: '/animals/', method: 'GET', headers: { 'Content-Type': 'application/json' } @@ -45,7 +45,7 @@ app.get('/animals/', function (req, res) { }); req.on('error', function(e) { - console.error('Problem with request: ' + e.message); + console.error('Problem with request: ' + e.message) res.status(500).send("ERROR") }); diff --git a/service002/config/default.json b/service002/config/default.json index 8c3dab4..6091d99 100644 --- a/service002/config/default.json +++ b/service002/config/default.json @@ -1,3 +1,9 @@ { - "secret": "myverysecuresecret" + "secret": "myverysecuresecret", + "service": { + "001": { + "host": "127.0.0.1", + "port": 4001 + } + } } \ No newline at end of file