feat: microservices be gone (#9551)
* feat: microservices be gone and api is a worker now too * chore: remove very old startup scripts, surely nobody is using these anymore, right? right?....
This commit is contained in:
21
server/src/utils/workers.ts
Normal file
21
server/src/utils/workers.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
const WORKER_TYPES = new Set(['api', 'microservices']);
|
||||
|
||||
export const getWorkers = () => {
|
||||
let workers = ['api', 'microservices'];
|
||||
const includedWorkers = process.env.IMMICH_WORKERS_INCLUDE?.replaceAll(/\s/g, '');
|
||||
const excludedWorkers = process.env.IMMICH_WORKERS_EXCLUDE?.replaceAll(/\s/g, '');
|
||||
|
||||
if (includedWorkers) {
|
||||
workers = includedWorkers.split(',');
|
||||
}
|
||||
|
||||
if (excludedWorkers) {
|
||||
workers = workers.filter((worker) => !excludedWorkers.split(',').includes(worker));
|
||||
}
|
||||
|
||||
if (workers.some((worker) => !WORKER_TYPES.has(worker))) {
|
||||
throw new Error(`Invalid worker(s) found: ${workers}`);
|
||||
}
|
||||
|
||||
return workers;
|
||||
};
|
||||
Reference in New Issue
Block a user