blob: 3778addd10f273d05656ad755c1dd9cbfb9f0c83 [file] [log] [blame]
Matteo Scandoloe3ed0162016-12-01 10:09:12 -08001(function () {
2 'use strict';
3
4 // NOTE do we still need CLI args?
5 // Won't be better to use NODE_ENV and the native node-yaml-config feature
6
7 const argv = require('yargs').argv;
8 const path = require('path');
9 const yaml_config = require('node-yaml-config');
10 const logger = require('../config/logger.js');
11
12 // if a config file is specified in as a CLI arguments use that one
13 const cfgFile = argv.config || 'config.yml';
14
15 let config;
16 try {
17 logger.log('debug', `Loading ${cfgFile}`);
18 config = yaml_config.load(path.join(__dirname, cfgFile));
19 }
20 catch(e) {
21 logger.log('debug', `No ${cfgFile} found, using default params`);
22 }
23
24 module.exports = {
25 xos: {
26 host: (config && config.xos) ? config.xos.host : 'xos',
Matteo Scandolo141e2862017-01-10 12:03:40 -080027 port: (config && config.xos) ? config.xos.port : 8000
Matteo Scandoloe3ed0162016-12-01 10:09:12 -080028 },
29 redis: {
30 host: (config && config.redis) ? config.redis.host : 'redis',
31 port: (config && config.redis) ? config.redis.port : 6379
32 },
33 gateway: {
34 port: (config && config.gateway) ? config.gateway.port : 3000
35 }
36 };
37})();