Skip to content

Commit

Permalink
chore(master): log configFrom on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed Nov 8, 2018
1 parent 69811fe commit b3c5942
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 13 additions & 7 deletions bin/proxy/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@ if (global[__filename]) {
}

if (typeof processArgs.config === 'string') {
cache.config = require(path.resolve(cwd, processArgs.config));
cache.config = loadConfig(path.resolve(cwd, processArgs.config));
} else if (typeof process.env.TSW_CONFIG_PATH === 'string') {
cache.config = require(process.env.TSW_CONFIG_PATH);
cache.config = loadConfig(process.env.TSW_CONFIG_PATH);
} else if (fs.existsSync(currConfig)) {
cache.config = require(currConfig);
cache.config = loadConfig(currConfig);
} else if (fs.existsSync('/etc/tsw.config.js')) {
cache.config = require('/etc/tsw.config.js');
cache.config = loadConfig('/etc/tsw.config.js');
} else if (fs.existsSync('/usr/local/node_modules/config.js')) {
cache.config = require('/usr/local/node_modules/config.js');
cache.config = loadConfig('/usr/local/node_modules/config.js');
} else if (fs.existsSync('/data/release/node_modules/config.js')) {
cache.config = require('/data/release/node_modules/config.js');
cache.config = loadConfig('/data/release/node_modules/config.js');
} else if (fs.existsSync(__dirname + '/../../conf/config.js')) {
cache.config = require('../../conf/config.js');
cache.config = loadConfig(__dirname + '/../../conf/config.js');
}

function loadConfig(configFrom) {
const config = require(configFrom);
config.configFrom = configFrom;
return config;
}


Expand Down
2 changes: 2 additions & 0 deletions bin/proxy/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function startServer() {
}, 3000);

logger.info('start master....');
logger.info(`config from: ${config.configFrom}`);
logger.info('version node: ${node}, modules: ${modules}', process.versions);

if (serverOS.isLinux) {
Expand Down Expand Up @@ -140,6 +141,7 @@ function startServer() {

process.title = 'TSW/worker/node';
logger.info('start worker....');
logger.info(`config from: ${config.configFrom}`);
require('./http.proxy.js');
require('runtime/jank.watcher.js');

Expand Down

0 comments on commit b3c5942

Please sign in to comment.