From 57eba519599f627122631719e98bc8451f8c5456 Mon Sep 17 00:00:00 2001 From: jj Date: Sat, 31 May 2025 13:43:22 +0000 Subject: [PATCH] api/env: broadcast raw contents instead of parsed --- api/src/config.js | 2 -- api/src/core/env.js | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/config.js b/api/src/config.js index a5ebf3d6..058db83b 100644 --- a/api/src/config.js +++ b/api/src/config.js @@ -19,8 +19,6 @@ export const updateEnv = (newEnv) => { for (const key in env) { env[key] = newEnv[key]; } - - cluster.broadcast({ env_update: newEnv }); } await validateEnvs(env); diff --git a/api/src/core/env.js b/api/src/core/env.js index 4e41760c..35c892f9 100644 --- a/api/src/core/env.js +++ b/api/src/core/env.js @@ -113,8 +113,9 @@ export const validateEnvs = async (env) => { const reloadEnvs = async (contents) => { const newEnvs = {}; + const resolvedContents = await contents; - for (let line of (await contents).split('\n')) { + for (let line of resolvedContents.split('\n')) { line = line.trim(); if (line === '') { continue; @@ -138,6 +139,7 @@ const reloadEnvs = async (contents) => { const parsed = loadEnvs(candidate); await validateEnvs(parsed); updateEnv(parsed); + cluster.broadcast({ env_update: resolvedContents }); } const wrapReload = (contents) => { @@ -182,7 +184,7 @@ export const setupEnvWatcher = () => { } else if (cluster.isWorker) { process.on('message', (message) => { if ('env_update' in message) { - updateEnv(message.env_update); + reloadEnvs(message.env_update); } }); }