Skip to content

Commit

Permalink
feat: set cluster options, include path, port, hostname (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored Jul 27, 2017
1 parent e9f93cf commit 3ef1de9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,21 @@ module.exports = appInfo => {
*/
config.workerStartTimeout = 10 * 60 * 1000;

/**
*
* @member {Object} Config#cluster
* @property {Object} listen - listen options, see {@link https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback}
* @property {String} listen.path - set a unix sock path when server listen
* @property {Number} listen.port - set a port when server listen
* @property {String} listen.hostname - set a hostname binding server when server listen
*/
config.cluster = {
listen: {
path: '',
port: 7001,
hostname: '',
},
};

return config;
};
8 changes: 8 additions & 0 deletions test/lib/core/loader/config_loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ describe('test/lib/core/loader/config_loader.test.js', () => {
assert.deepEqual(app.config.logger.dir, path.join(home, 'logs/demo'));
assert(app.config.logger.disableConsoleAfterReady === true);
});

it('should get cluster defaults', function* () {
app = utils.app('apps/demo');
yield app.ready();
assert(app.config.cluster.listen.path === '');
assert(app.config.cluster.listen.port === 7001);
assert(app.config.cluster.listen.hostname === '');
});
});

0 comments on commit 3ef1de9

Please sign in to comment.