Skip to content
Snippets Groups Projects
Unverified Commit 5dab9189 authored by dogcraft's avatar dogcraft Committed by GitHub
Browse files

enhance(backend): add unix socket support (#11275)


* unix socket support

* add changelog

* lint

---------

Co-authored-by: default avatarsyuilo <Syuilotan@yahoo.co.jp>
parent 4f22176b
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ url: https://example.tld/
# The port that your Misskey server should listen on.
port: 3000
# You can also use UNIX domain socket.
# socket: /path/to/misskey.sock
# chmodSocket: '777'
# ┌──────────────────────────┐
#───┘ PostgreSQL configuration └────────────────────────────────
......
......@@ -61,6 +61,7 @@
- Fix: Remove Meilisearch index when notes are deleted
- Fix: 非英語環境でのPostgreSQLのエラーハンドリングを修正
- Fix: インスタンスのアイコンがbase64の場合の挙動を修正
- Add unix socket support
## 13.13.2
......
......@@ -78,7 +78,7 @@ export async function masterMain() {
await spawnWorkers(config.clusterLimit);
}
bootLogger.succ(`Now listening on port ${config.port} on ${config.url}`, null, true);
bootLogger.succ(config.socket ? `Now listening on socket ${config.socket} on ${config.url}` : `Now listening on port ${config.port} on ${config.url}`, null, true);
}
function showEnvironment(): void {
......
......@@ -14,7 +14,9 @@ export type Source = {
repository_url?: string;
feedback_url?: string;
url: string;
port: number;
port?: number;
socket?: string;
chmodSocket?: string;
disableHsts?: boolean;
db: {
host: string;
......
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment