From 212b07394d9fb66670e7c09718fb6d24f4a6a6d4 Mon Sep 17 00:00:00 2001 From: jj Date: Sat, 7 Jun 2025 09:23:09 +0000 Subject: [PATCH] api: set up env watcher only after cluster is initialized --- api/src/cobalt.js | 5 +++++ api/src/config.js | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/src/cobalt.js b/api/src/cobalt.js index 5cac208d..cf531297 100644 --- a/api/src/cobalt.js +++ b/api/src/cobalt.js @@ -9,6 +9,7 @@ import { fileURLToPath } from "url"; import { env, isCluster } from "./config.js" import { Red } from "./misc/console-text.js"; import { initCluster } from "./misc/cluster.js"; +import { setupEnvWatcher } from "./core/env.js"; const app = express(); @@ -24,6 +25,10 @@ if (env.apiURL) { await initCluster(); } + if (env.envFile) { + setupEnvWatcher(); + } + runAPI(express, app, __dirname, cluster.isPrimary); } else { console.log( diff --git a/api/src/config.js b/api/src/config.js index ceac2f6d..8f1579b8 100644 --- a/api/src/config.js +++ b/api/src/config.js @@ -1,5 +1,5 @@ import { getVersion } from "@imput/version-info"; -import { loadEnvs, validateEnvs, setupEnvWatcher } from "./core/env.js"; +import { loadEnvs, validateEnvs } from "./core/env.js"; const version = await getVersion(); @@ -29,10 +29,6 @@ export const updateEnv = (newEnv) => { await validateEnvs(env); -if (env.envFile) { - setupEnvWatcher(); -} - export { env, genericUserAgent,