Merge pull request #1479 from thelounge/xpaw/unix-socket
Add support for binding to unix sockets
This commit is contained in:
commit
9e1296d303
@ -16,6 +16,8 @@ module.exports = {
|
|||||||
// IP address or hostname for the web server to listen on.
|
// IP address or hostname for the web server to listen on.
|
||||||
// Setting this to undefined will listen on all interfaces.
|
// Setting this to undefined will listen on all interfaces.
|
||||||
//
|
//
|
||||||
|
// For UNIX domain sockets, use unix:/absolute/path/to/file.sock.
|
||||||
|
//
|
||||||
// @type string
|
// @type string
|
||||||
// @default undefined
|
// @default undefined
|
||||||
//
|
//
|
||||||
|
@ -83,18 +83,30 @@ module.exports = function() {
|
|||||||
}, app);
|
}, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
server.listen({
|
let listenParams;
|
||||||
|
|
||||||
|
if (typeof config.host === "string" && config.host.startsWith("unix:")) {
|
||||||
|
listenParams = config.host.replace(/^unix:/, "");
|
||||||
|
} else {
|
||||||
|
listenParams = {
|
||||||
port: config.port,
|
port: config.port,
|
||||||
host: config.host,
|
host: config.host,
|
||||||
}, () => {
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
server.listen(listenParams, () => {
|
||||||
|
if (typeof listenParams === "string") {
|
||||||
|
log.info("Available on socket " + colors.green(listenParams));
|
||||||
|
} else {
|
||||||
const protocol = config.https.enable ? "https" : "http";
|
const protocol = config.https.enable ? "https" : "http";
|
||||||
var address = server.address();
|
const address = server.address();
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
"Available at " +
|
"Available at " +
|
||||||
colors.green(`${protocol}://${address.address}:${address.port}/`) +
|
colors.green(`${protocol}://${address.address}:${address.port}/`) +
|
||||||
` in ${colors.bold(config.public ? "public" : "private")} mode`
|
` in ${colors.bold(config.public ? "public" : "private")} mode`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const sockets = io(server, {
|
const sockets = io(server, {
|
||||||
serveClient: false,
|
serveClient: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user