Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import type { EnvRecord } from "@toolctrl/config";
|
||||
import { getQueueNamesForGroup, isWorkerQueueGroup, queueNames, type QueueName } from "@toolctrl/queue";
|
||||
|
||||
export const defaultWorkerQueueNames = [queueNames.email, queueNames.notifications] as const satisfies readonly QueueName[];
|
||||
|
||||
export function getWorkerQueueNames(
|
||||
env: EnvRecord & {
|
||||
EXPORT_RETENTION_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_RUNTIME_READY?: string;
|
||||
SCAN_QUEUE_ENABLED?: string;
|
||||
WORKER_QUEUE_GROUP?: string;
|
||||
} = process.env as EnvRecord
|
||||
): readonly QueueName[] {
|
||||
if (typeof env.WORKER_QUEUE_GROUP === "string" && isWorkerQueueGroup(env.WORKER_QUEUE_GROUP)) {
|
||||
if (env.WORKER_QUEUE_GROUP === "import" && (env.IMPORT_QUEUE_ENABLED !== "true" || env.IMPORT_QUEUE_RUNTIME_READY !== "true")) {
|
||||
return [];
|
||||
}
|
||||
return getQueueNamesForGroup(env.WORKER_QUEUE_GROUP);
|
||||
}
|
||||
|
||||
const queues: QueueName[] = [...defaultWorkerQueueNames];
|
||||
if (env.IMPORT_QUEUE_ENABLED === "true") {
|
||||
queues.push(queueNames.imports);
|
||||
}
|
||||
if (env.EXPORT_RETENTION_QUEUE_ENABLED === "true") {
|
||||
queues.push(queueNames.maintenance);
|
||||
}
|
||||
if (env.SCAN_QUEUE_ENABLED === "true") {
|
||||
queues.push(queueNames.fileScan);
|
||||
}
|
||||
|
||||
return queues;
|
||||
}
|
||||
Reference in new issue
Block a user