Files
homarr/packages/core/src/infrastructure/env/prefix.ts
2025-07-20 17:13:57 +02:00

14 lines
378 B
TypeScript

export const runtimeEnvWithPrefix = (prefix: `${string}_`) =>
Object.entries(process.env)
.filter(([key]) => key.startsWith(prefix))
.reduce(
(acc, [key, value]) => {
if (value === undefined) return acc;
const newKey = key.replace(prefix, "");
acc[newKey] = value;
return acc;
},
{} as Record<string, string>,
);