diff --git a/frontend/fetch-openapi.js b/frontend/fetch-openapi.js index b468a86..c840463 100644 --- a/frontend/fetch-openapi.js +++ b/frontend/fetch-openapi.js @@ -142,10 +142,18 @@ async function fetchAndGenerate() { } // Backend directory based on the environment -const backendDirectory = - nodeEnv === 'test' - ? path.resolve('/home/jungfrau/heidi-v2/backend/app') - : path.resolve('/Users/gotthardg/PycharmProjects/heidi-v2/backend/app'); +// Backend directory based on the environment +const backendDirectory = (() => { + switch (nodeEnv) { + case 'prod': + return path.resolve('/home/jungfrau/heidi-v2/backend/app'); // Production path + case 'test': + return path.resolve('/home/jungfrau/heidi-v2/backend/app'); // Test path + case 'dev': + default: + return path.resolve('/Users/gotthardg/PycharmProjects/heidi-v2/backend/app'); // Development path + } +})(); if (!fs.existsSync(backendDirectory)) { console.error(`❌ Backend directory does not exist: ${backendDirectory}`);