feat(infra): add external redis (#3639)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { createEnv } from "@homarr/env";
|
||||
import { createEnv } from "@homarr/core/infrastructure/env";
|
||||
|
||||
import { logLevels } from "./constants";
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Redis } from "ioredis";
|
||||
import superjson from "superjson";
|
||||
import Transport from "winston-transport";
|
||||
|
||||
import type { RedisClient } from "@homarr/core/infrastructure/redis";
|
||||
import { createRedisClient } from "@homarr/core/infrastructure/redis";
|
||||
|
||||
const messageSymbol = Symbol.for("message");
|
||||
const levelSymbol = Symbol.for("level");
|
||||
|
||||
@@ -10,7 +12,7 @@ const levelSymbol = Symbol.for("level");
|
||||
// of the base functionality and `.exceptions.handle()`.
|
||||
//
|
||||
export class RedisTransport extends Transport {
|
||||
private redis: Redis | null = null;
|
||||
private redis: RedisClient | null = null;
|
||||
|
||||
/**
|
||||
* Log the info to the Redis channel
|
||||
@@ -21,7 +23,7 @@ export class RedisTransport extends Transport {
|
||||
});
|
||||
|
||||
// Is only initialized here because it did not work when initialized in the constructor or outside the class
|
||||
this.redis ??= new Redis();
|
||||
this.redis ??= createRedisClient();
|
||||
|
||||
this.redis
|
||||
.publish(
|
||||
|
||||
Reference in New Issue
Block a user