api: set up env watcher only after cluster is initialized

This commit is contained in:
jj 2025-06-07 09:23:09 +00:00
parent e2b6879ea2
commit 212b07394d
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -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(

View File

@ -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,