Skip to content

Commit

Permalink
use environment or configuration endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jun 11, 2024
1 parent 1b9b19a commit 97303e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@

let VITE_SERVER_URL;

if (typeof import.meta !== 'undefined' && import.meta.env) {
VITE_SERVER_URL = import.meta.env.VITE_SERVER_URL;
} else {
VITE_SERVER_URL = process.env.VITE_SERVER_URL || "http://localhost:5000";
}

const config = {
DEMO_SITE_URL:"https://annotate-docs.dwaste.live/",
VITE_SERVER_URL: "http://localhost:5000",
VITE_SERVER_URL
};

export default config;
Expand Down
5 changes: 5 additions & 0 deletions client/src/SetupPage/SetupPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jest.mock('react-i18next', () => ({
}),
}));

jest.mock('../../config.js', () => ({
DEMO_SITE_URL: "https://annotate-docs.dwaste.live/",
VITE_SERVER_URL: "http://localhost:5000",
}));

// Mock useSettings hook
jest.mock('../SettingsProvider', () => ({
useSettings: jest.fn(),
Expand Down
6 changes: 6 additions & 0 deletions client/src/workspace/DownloadButton/DownloadButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ jest.mock('../../SnackbarContext/index.jsx', () => ({
}),
}));

jest.mock('../../../config.js', () => ({
DEMO_SITE_URL: "https://annotate-docs.dwaste.live/",
VITE_SERVER_URL: "http://localhost:5000",
}));


// Mock the useTranslation hook with actual translations
jest.mock('react-i18next', () => ({
useTranslation: () => ({
Expand Down

0 comments on commit 97303e6

Please sign in to comment.