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

Fix: Add support for IPC connections.

Read this for more details:
https://nodejs.org/api/net.html#net_identifying_paths_for_ipc_connections
This commit is contained in:
ivaosthu 2019-04-26 08:45:45 +02:00 committed by Ivar Conradi Østhus
parent be37ede37c
commit ccce6056dd
3 changed files with 10 additions and 3 deletions

View File

@ -45,7 +45,9 @@ Available unleash options include:
- **databaseUrl** - the postgres database url to connect to. Should include username/password.
- **databaseSchema** - the postgres database schema to use. Defaults to 'public'.
- **port** - which port the unleash-server should bind to.
- **port** - which port the unleash-server should bind to. If port is omitted or is 0, the operating system will assign an arbitrary unused port. Will be ignored if pipe is specified.
- **host** - which host the unleash-server should bind to. If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise.
- **pipe** - parameter to identify IPC endpoints. See https://nodejs.org/api/net.html#net_identifying_paths_for_ipc_connections for more details
- **enableLegacyRoutes** (boolean) - allows you to turn on/off support for legacy routes to support older clients. Enabled by default.
- **serverMetrics** (boolean) - use this option to turn on/off prometheus metrics.
- **preHook** (function) - this is a hook if you need to provide any middlewares to express before `unleash` adds any. Express app instance is injected as first argument.

View File

@ -10,6 +10,7 @@ const DEFAULT_OPTIONS = {
databaseSchema: 'public',
port: process.env.HTTP_PORT || process.env.PORT || 4242,
host: process.env.HTTP_HOST,
pipe: undefined,
baseUriPath: process.env.BASE_URI_PATH || '',
serverMetrics: true,
enableLegacyRoutes: true,
@ -40,6 +41,10 @@ module.exports = {
);
}
options.listen = options.pipe
? { path: options.pipe }
: { port: options.port, host: options.host };
return options;
},
};

View File

@ -46,8 +46,8 @@ async function createApp(options) {
});
}
const server = app.listen({ port: options.port, host: options.host }, () =>
logger.info(`Unleash started on port ${server.address().port}`)
const server = app.listen(options.listen, () =>
logger.info('Unleash has started.', server.address())
);
return new Promise((resolve, reject) => {