diff options
| author | dogcraft <neko@neko.red> | 2023-07-17 13:12:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-17 14:12:02 +0900 |
| commit | 5dab9189999255fce2d89f5737f1166805f893af (patch) | |
| tree | 4dad2f3cbbcf0cc762c6b283a06d7444e0c568cc /packages/backend/src/server/ServerService.ts | |
| parent | perf(frontend): improve performance of contextmenu (diff) | |
| download | sharkey-5dab9189999255fce2d89f5737f1166805f893af.tar.gz sharkey-5dab9189999255fce2d89f5737f1166805f893af.tar.bz2 sharkey-5dab9189999255fce2d89f5737f1166805f893af.zip | |
enhance(backend): add unix socket support (#11275)
* unix socket support
* add changelog
* lint
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/server/ServerService.ts')
| -rw-r--r-- | packages/backend/src/server/ServerService.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/backend/src/server/ServerService.ts b/packages/backend/src/server/ServerService.ts index 1bae71617b..051920958e 100644 --- a/packages/backend/src/server/ServerService.ts +++ b/packages/backend/src/server/ServerService.ts @@ -224,7 +224,18 @@ export class ServerService implements OnApplicationShutdown { } }); - fastify.listen({ port: this.config.port, host: '0.0.0.0' }); + if (this.config.socket) { + if (fs.existsSync(this.config.socket)) { + fs.unlinkSync(this.config.socket); + } + fastify.listen({ path: this.config.socket }, (err, address) => { + if (this.config.chmodSocket) { + fs.chmodSync(this.config.socket!, this.config.chmodSocket); + } + }); + } else { + fastify.listen({ port: this.config.port, host: '0.0.0.0' }); + } await fastify.ready(); } |