1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

feat(bind): Added option to bind to http address.

Closes #318
This commit is contained in:
Ivar Conradi Østhus 2018-05-06 10:23:53 +02:00
parent e909ec808d
commit 4f808f13eb
3 changed files with 10 additions and 3 deletions

View File

@ -15,6 +15,12 @@ const argv = require('yargs')
default: 4242,
type: 'number',
})
.option('host', {
alias: 'l',
describe: 'The HTTP address the server will accept connections on.',
demand: false,
type: 'string',
})
.option('databaseUrl', {
alias: 'd',
describe:
@ -25,9 +31,9 @@ const argv = require('yargs')
serverImpl
.start(argv)
.then(conf =>
.then(() =>
console.log(
`Unleash started on http://localhost:${conf.app.get('port')}`
`Unleash started on http://${argv.host || '127.0.0.1'}:${argv.port}`
)
)
.catch(console.err);

View File

@ -8,6 +8,7 @@ const THIRTY_DAYS = 30 * 24 * 60 * 60 * 1000;
const DEFAULT_OPTIONS = {
databaseUrl: process.env.DATABASE_URL,
port: process.env.HTTP_PORT || process.env.PORT || 4242,
host: undefined,
baseUriPath: process.env.BASE_URI_PATH || '',
serverMetrics: true,
enableLegacyRoutes: true,

View File

@ -26,7 +26,7 @@ function createApp(options) {
);
const app = getApp(config);
const server = app.listen(app.get('port'), () => {
const server = app.listen(app.get('port'), options.host, () => {
logger.info(`Unleash started on ${app.get('port')}`);
});