Skip to content

Commit 4a8c9b9

Browse files
committed
Add configuration for http bind host (#55)
1 parent 0a16079 commit 4a8c9b9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const defaultConfiguration = {
3636
development: !(process.env.NODE_ENV || '').match(/^prod/i),
3737
logging: true,
3838
index: 'index.html',
39-
hostname: 'localhost',
39+
bind: '0.0.0.0',
4040
port: 8000,
4141
public: null,
4242
morgan: 'tiny',

src/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,14 @@ class Core extends CoreBase {
201201
*/
202202
listen() {
203203
const httpPort = this.config('port');
204+
const httpHost = this.config('bind');
204205
const wsPort = this.config('ws.port') || httpPort;
205206
const pub = this.config('public');
206207
const session = path.basename(path.dirname(this.config('session.store.module')));
207208
const dist = pub.replace(process.cwd(), '');
208209
const secure = this.config('https.enabled', false);
209210
const proto = prefix => `${prefix}${secure ? 's' : ''}://`;
210-
const host = port => `${this.config('hostname')}:${port}`;
211+
const host = port => `${httpHost}:${port}`;
211212

212213
logger.info('Opening server connection');
213214

@@ -216,7 +217,7 @@ class Core extends CoreBase {
216217
logger.warn('Missing files in "dist/" directory. Did you forget to run "npm run build" ?');
217218
}
218219

219-
this.httpServer.listen(httpPort, () => {
220+
this.httpServer.listen(httpPort, httpHost, () => {
220221
logger.success(`Using '${session}' sessions`);
221222
logger.success(`Serving '${dist}'`);
222223
logger.success(`WebSocket listening on ${proto('ws')}${host(wsPort)}`);

0 commit comments

Comments
 (0)