diff --git a/server/endpoints/api/system/index.js b/server/endpoints/api/system/index.js index d129416231f04c1bc070a8a5f4db7a768f215329..7d97555e58ea52b0d8c58678181ba0af9d96689c 100644 --- a/server/endpoints/api/system/index.js +++ b/server/endpoints/api/system/index.js @@ -145,7 +145,6 @@ function apiSystemEndpoints(app) { try { const body = reqBody(request); const { newValues, error } = await updateENV(body); - if (process.env.NODE_ENV === "production") await dumpENV(); response.status(200).json({ newValues, error }); } catch (e) { console.log(e.message, e); diff --git a/server/endpoints/system.js b/server/endpoints/system.js index 6ab30c5c10a38dc2ae3bdb4dabffde8ad230c250..ef3c4f7e9d2fda1646107d420dc9ec5abdb76306 100644 --- a/server/endpoints/system.js +++ b/server/endpoints/system.js @@ -416,7 +416,6 @@ function systemEndpoints(app) { false, response?.locals?.user?.id ); - if (process.env.NODE_ENV === "production") await dumpENV(); response.status(200).json({ newValues, error }); } catch (e) { console.log(e.message, e); @@ -451,8 +450,6 @@ function systemEndpoints(app) { true )?.error; } - - if (process.env.NODE_ENV === "production") await dumpENV(); response.status(200).json({ success: !error, error }); } catch (e) { console.log(e.message, e); @@ -493,7 +490,6 @@ function systemEndpoints(app) { }, true ); - if (process.env.NODE_ENV === "production") await dumpENV(); await Telemetry.sendTelemetry("enabled_multi_user_mode", { multiUserMode: true, }); diff --git a/server/utils/helpers/updateENV.js b/server/utils/helpers/updateENV.js index 5136419171eee17c2abe7ba2a8a6f9545baaf0ab..78d84053995e351237ebaa9ac341faa07df34227 100644 --- a/server/utils/helpers/updateENV.js +++ b/server/utils/helpers/updateENV.js @@ -719,6 +719,7 @@ async function updateENV(newENVs = {}, force = false, userId = null) { } await logChangesToEventLog(newValues, userId); + if (process.env.NODE_ENV === "production") await dumpENV(); return { newValues, error: error?.length > 0 ? error : false }; } @@ -751,6 +752,8 @@ async function dumpENV() { const frozenEnvs = {}; const protectedKeys = [ ...Object.values(KEY_MAPPING).map((values) => values.envKey), + // Manually Add Keys here which are not already defined in KEY_MAPPING + // and are either managed or manually set ENV key:values. "STORAGE_DIR", "SERVER_PORT", // Password Schema Keys if present. @@ -765,16 +768,6 @@ async function dumpENV() { "ENABLE_HTTPS", "HTTPS_CERT_PATH", "HTTPS_KEY_PATH", - // DISABLED TELEMETRY - "DISABLE_TELEMETRY", - - // Agent Integrations - // Search engine integrations - "AGENT_GSE_CTX", - "AGENT_GSE_KEY", - "AGENT_SERPER_DEV_KEY", - "AGENT_BING_SEARCH_API_KEY", - "AGENT_SERPLY_API_KEY", ]; // Simple sanitization of each value to prevent ENV injection via newline or quote escaping.