mirror of
https://github.com/immich-app/immich.git
synced 2025-01-07 20:36:48 +01:00
f44fa45aa0
* add unicorn to eslint * fix lint errors for cli * fix merge * fix album name extraction * Update cli/src/commands/upload.command.ts Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * es2k23 * use lowercase os * return undefined album name * fix bug in asset response dto * auto fix issues * fix server code style * es2022 and formatting * fix compilation error * fix test * fix config load * fix last lint errors * set string type * bump ts * start work on web * web formatting * Fix UUIDParamDto as UUIDParamDto * fix library service lint * fix web errors * fix errors * formatting * wip * lints fixed * web can now start * alphabetical package json * rename error * chore: clean up --------- Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { QueueName } from '@app/domain';
|
|
import { RegisterQueueOptions } from '@nestjs/bullmq';
|
|
import { QueueOptions } from 'bullmq';
|
|
import { RedisOptions } from 'ioredis';
|
|
|
|
function parseRedisConfig(): RedisOptions {
|
|
const redisUrl = process.env.REDIS_URL;
|
|
if (redisUrl && redisUrl.startsWith('ioredis://')) {
|
|
try {
|
|
const decodedString = Buffer.from(redisUrl.slice(10), 'base64').toString();
|
|
return JSON.parse(decodedString);
|
|
} catch (error) {
|
|
throw new Error(`Failed to decode redis options: ${error}`);
|
|
}
|
|
}
|
|
return {
|
|
host: process.env.REDIS_HOSTNAME || 'immich_redis',
|
|
port: Number.parseInt(process.env.REDIS_PORT || '6379'),
|
|
db: Number.parseInt(process.env.REDIS_DBINDEX || '0'),
|
|
username: process.env.REDIS_USERNAME || undefined,
|
|
password: process.env.REDIS_PASSWORD || undefined,
|
|
path: process.env.REDIS_SOCKET || undefined,
|
|
};
|
|
}
|
|
|
|
export const bullConfig: QueueOptions = {
|
|
prefix: 'immich_bull',
|
|
connection: parseRedisConfig(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
removeOnComplete: true,
|
|
removeOnFail: false,
|
|
},
|
|
};
|
|
|
|
export const bullQueues: RegisterQueueOptions[] = Object.values(QueueName).map((name) => ({ name }));
|