From d690790dfed2de13ff92a1c5c2d9b7771d02cf35 Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 21 Aug 2025 11:57:12 -0400 Subject: [PATCH] feature/IO-3255-simplified-parts-management - Remove unnecessary dotenv calls / fix import bug --- libs/awsUtils.js | 3 --- os-loader.js | 2 +- server/utils/statusReporter.js | 5 +---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libs/awsUtils.js b/libs/awsUtils.js index 0cb29337a..2137eeef8 100644 --- a/libs/awsUtils.js +++ b/libs/awsUtils.js @@ -1,6 +1,3 @@ -require("dotenv").config({ - path: require("path").resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`) -}); const { isNil } = require("lodash"); const aws4 = require("aws4"); const { Connection, Client } = require("@opensearch-project/opensearch"); diff --git a/os-loader.js b/os-loader.js index 08a5e7190..2e46c6fa7 100644 --- a/os-loader.js +++ b/os-loader.js @@ -4,7 +4,7 @@ require("dotenv").config({ const { omit } = require("lodash"); const gqlClient = require("./server/graphql-client/graphql-client").client; -const getClient = require("./libs/awsUtils"); +const { getClient } = require("./libs/awsUtils"); async function OpenSearchUpdateHandler(req, res) { try { diff --git a/server/utils/statusReporter.js b/server/utils/statusReporter.js index fc425da33..1670bc348 100644 --- a/server/utils/statusReporter.js +++ b/server/utils/statusReporter.js @@ -1,10 +1,7 @@ // Load environment variables THIS MUST BE AT THE TOP -const path = require("path"); +// Removed redundant dotenv initialization; server.js loads env vars at process start. const getHostNameOrIP = require("./getHostNameOrIP"); const logger = require("./logger"); -require("dotenv").config({ - path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`) -}); const CrispStatusReporter = require("crisp-status-reporter").CrispStatusReporter; const InstanceManager = require("../utils/instanceMgr").default;