Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix(dns): disable caching by default (#4007)

Meier Lukas10668ee35994
diff --git a/packages/common/env.ts b/packages/common/env.ts
index cbccc8b70..c52abbd25 100644
--- a/packages/common/env.ts
+++ b/packages/common/env.ts
@@ -24,10 +24,12 @@ export const env = createEnv({
message: `SECRET_ENCRYPTION_KEY must only contain hex characters${errorSuffix}`,
}),
NO_EXTERNAL_CONNECTION: createBooleanSchema(false),
+ ENABLE_DNS_CACHING: createBooleanSchema(false),
},
runtimeEnv: {
SECRET_ENCRYPTION_KEY: process.env.SECRET_ENCRYPTION_KEY,
NODE_ENV: process.env.NODE_ENV,
NO_EXTERNAL_CONNECTION: process.env.NO_EXTERNAL_CONNECTION,
+ ENABLE_DNS_CACHING: process.env.ENABLE_DNS_CACHING,
},
});
diff --git a/packages/common/src/dns.ts b/packages/common/src/dns.ts
index 6e1e65c7c..7a8578b2b 100644
--- a/packages/common/src/dns.ts
+++ b/packages/common/src/dns.ts
@@ -2,6 +2,8 @@ import { DnsCacheManager } from "dns-caching";
import { logger } from "@homarr/log";
+import { env } from "../env";
+
// Add global type augmentation for homarr
declare global {
var homarr: {
@@ -19,4 +21,6 @@ global.homarr.dnsCacheManager ??= new DnsCacheManager({
logger,
});
-global.homarr.dnsCacheManager.initialize();
+if (env.ENABLE_DNS_CACHING) {
+ global.homarr.dnsCacheManager.initialize();
+}