fix: replace winston with pino #6

Merged
t.behrendt merged 3 commits from fix-replace-winston-with-pino into main 2025-01-08 14:01:02 +01:00
Showing only changes of commit 01a8b10c57 - Show all commits

View File

@@ -11,13 +11,16 @@ const envVar = from(process.env, {
throw new Error("Invalid log level"); throw new Error("Invalid log level");
} }
}, },
asTs3GotifyMode: (value): Mode => { asTs3GotifyMode: (value): Mode[] => {
const parsedValue: string[] = envVar.accessors.asJsonArray(value);
const modes = ["connect", "disconnect", "moved", "message"]; const modes = ["connect", "disconnect", "moved", "message"];
if (modes.includes(value)) { for (const mode of parsedValue) {
return value as Mode; if (!modes.includes(mode)) {
} else { throw new Error("Invalid mode");
throw new Error("Invalid mode"); }
} }
return parsedValue as Mode[];
}, },
}); });
@@ -46,8 +49,4 @@ export const GOTIFY_TITLE = envVar
.default("ts3gotify") .default("ts3gotify")
.asString(); .asString();
export const MODE = envVar export const MODE = envVar.get("MODE").default('["connect"]').asTs3GotifyMode();
.get("MODE")
.default("['connect']")
.asJsonArray()
.map((value) => value.asTs3GotifyMode());