mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: allow server to bind to Unix Domain Sockets
This commit is contained in:
committed by
Joachim Van Herwegen
parent
0eb50891ec
commit
bf0e35be37
@@ -33,6 +33,11 @@ const portNames = [
|
||||
'BaseHttpServerFactory',
|
||||
] as const;
|
||||
|
||||
const socketNames = [
|
||||
// Unit
|
||||
'BaseHttpServerFactory',
|
||||
];
|
||||
|
||||
export function getPort(name: typeof portNames[number]): number {
|
||||
const idx = portNames.indexOf(name);
|
||||
// Just in case something doesn't listen to the typings
|
||||
@@ -42,6 +47,15 @@ export function getPort(name: typeof portNames[number]): number {
|
||||
return 6000 + idx;
|
||||
}
|
||||
|
||||
export function getSocket(name: typeof socketNames[number]): string {
|
||||
const idx = socketNames.indexOf(name);
|
||||
// Just in case something doesn't listen to the typings
|
||||
if (idx < 0) {
|
||||
throw new Error(`Unknown socket name ${name}`);
|
||||
}
|
||||
return `css${idx}.sock`;
|
||||
}
|
||||
|
||||
export function describeIf(envFlag: string): Describe {
|
||||
const flag = `TEST_${envFlag.toUpperCase()}`;
|
||||
const enabled = !/^(|0|false)$/iu.test(process.env[flag] ?? '');
|
||||
|
||||
Reference in New Issue
Block a user