From 4f6339b37c0bbdfa11c12cacb5d12265fb5dd59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Fri, 8 May 2026 17:37:33 +0900 Subject: [PATCH] Load backend env file reliably --- backend/src/config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/config.js b/backend/src/config.js index 935e3ce..7c766b6 100644 --- a/backend/src/config.js +++ b/backend/src/config.js @@ -1,6 +1,12 @@ import dotenv from 'dotenv'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; -dotenv.config(); +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const envPath = resolve(__dirname, '../.env'); + +dotenv.config({ path: envPath }); const bool = (value, fallback = false) => { if (value === undefined || value === null || value === '') return fallback;