Merge pull request #4166 from balki/patch-1

Support listening on unix socket
This commit is contained in:
advplyr 2025-05-16 16:19:47 -05:00 committed by GitHub
commit 241b56ad45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -395,10 +395,19 @@ class Server {
}) })
router.get('/healthcheck', (req, res) => res.sendStatus(200)) router.get('/healthcheck', (req, res) => res.sendStatus(200))
this.server.listen(this.Port, this.Host, () => { const unixSocketPrefix = 'unix/'
if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`) if (this.Host?.startsWith(unixSocketPrefix)) {
else Logger.info(`Listening on port :${this.Port}`) const sockPath = this.Host.slice(unixSocketPrefix.length)
}) this.server.listen(sockPath, async () => {
await fs.chmod(sockPath, 0o666)
Logger.info(`Listening on unix socket ${sockPath}`)
})
} else {
this.server.listen(this.Port, this.Host, () => {
if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`)
else Logger.info(`Listening on port :${this.Port}`)
})
}
// Start listening for socket connections // Start listening for socket connections
SocketAuthority.initialize(this) SocketAuthority.initialize(this)