mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
Merge branch 'main' into versions/6.0.0
# Conflicts: # src/init/ServerInitializer.ts # src/server/BaseHttpServerFactory.ts # src/server/HttpServerFactory.ts # src/server/WebSocketServerFactory.ts # test/unit/server/BaseHttpServerFactory.test.ts
This commit is contained in:
@@ -37,6 +37,11 @@ const portNames = [
|
||||
'BaseServerFactory',
|
||||
] 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
|
||||
@@ -46,6 +51,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