-
Notifications
You must be signed in to change notification settings - Fork 0
/
paramLoader.js
executable file
·32 lines (26 loc) · 978 Bytes
/
paramLoader.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
'use strict';
const O = require('output-manager');
const extend = require("xtend");
const fs = require('fs');
module.exports = () => {
const _propFile = (process.env.PROPS) ? process.env.PROPS : 'props.json';
var fileConnParams = {};
O.d("Looking for properties file: '" + _propFile + "'");
try {
fs.accessSync(_propFile, fs.F_OK);
fileConnParams = JSON.parse(fs.readFileSync(_propFile, 'utf-8'));
} catch (e) {
O.w("Could not find or access file '" + _propFile + "'");
}
O.t("Params from file: '" + JSON.stringify(fileConnParams) + "'");
var defaultConnectionParams = {
"protocol": "http",
"host": "api.bosh-lite.com",
"username": "admin",
"password": "admin",
"skipSSLValidation": "false"
};
var params = extend(defaultConnectionParams, fileConnParams);
O.t("Final params: '" + JSON.stringify(params) + "'");
return params;
}