diff --git a/frontend/jest.config.cjs b/frontend/jest.config.cjs index dab1cf45..94f9284c 100644 --- a/frontend/jest.config.cjs +++ b/frontend/jest.config.cjs @@ -24,7 +24,14 @@ module.exports = { { path: 'node_modules/ts-jest-mock-import-meta', options: { - metaObjectReplacement: { url: 'https://www.url.com' }, + metaObjectReplacement: { + url: 'https://www.url.com', + env: { + VITE_BACKEND_URL: 'http://localhost:8000/', + VITE_FRONTEND_URL: 'http://localhost:80', + VITE_CONTAINER_ORIGIN: 'http://localhost:8080/', + }, + }, }, }, ], diff --git a/frontend/src/components/HomeComponents/SetupGuide/SetupGuide.tsx b/frontend/src/components/HomeComponents/SetupGuide/SetupGuide.tsx index 25fb8a37..5e75cb5d 100644 --- a/frontend/src/components/HomeComponents/SetupGuide/SetupGuide.tsx +++ b/frontend/src/components/HomeComponents/SetupGuide/SetupGuide.tsx @@ -74,8 +74,8 @@ export const SetupGuide = (props: Props) => { commands one block at a time { ).toBeInTheDocument(); expect( - screen.getByText('task config sync.server.origin https://test-container') + screen.getByText('task config sync.server.url https://test-container') ).toBeInTheDocument(); }); diff --git a/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts b/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts index f59241eb..21bf4a50 100644 --- a/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts +++ b/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts @@ -19,7 +19,7 @@ describe('exportConfigSetup', () => { ); expect(result).toContain( - `task config sync.server.origin ${url.containerOrigin}` + `task config sync.server.url ${url.containerOrigin}` ); expect(result).toContain(`task config sync.server.client_id ${props.uuid}`); diff --git a/frontend/src/components/HomeComponents/SetupGuide/utils.ts b/frontend/src/components/HomeComponents/SetupGuide/utils.ts index d53cdb60..9824e459 100644 --- a/frontend/src/components/HomeComponents/SetupGuide/utils.ts +++ b/frontend/src/components/HomeComponents/SetupGuide/utils.ts @@ -5,7 +5,7 @@ export function exportConfigSetup(props: Props): string { return [ 'Configure Taskwarrior with these commands, run these commands one block at a time', `task config sync.encryption_secret ${props.encryption_secret}`, - `task config sync.server.origin ${url.containerOrigin}`, + `task config sync.server.url ${url.containerOrigin}`, `task config sync.server.client_id ${props.uuid}`, 'For more information about how this works, refer to the task-sync(5) manpage for details on how to configure the new sync implementation.', ].join('\n'); diff --git a/frontend/src/components/utils/URLs.ts b/frontend/src/components/utils/URLs.ts index f657742c..944254bc 100644 --- a/frontend/src/components/utils/URLs.ts +++ b/frontend/src/components/utils/URLs.ts @@ -12,9 +12,10 @@ export const url = isTesting taskchampionSyncServerURL: '', } : { - backendURL: 'http://localhost:8000/', - frontendURL: 'http://localhost:80', - containerOrigin: 'http://localhost:8080/', + backendURL: import.meta.env.VITE_BACKEND_URL || 'http://localhost:8000/', + frontendURL: import.meta.env.VITE_FRONTEND_URL || 'http://localhost:80', + containerOrigin: + import.meta.env.VITE_CONTAINER_ORIGIN || 'http://localhost:8080/', githubRepoURL: 'https://github.com/CCExtractor/ccsync', githubDocsURL: 'https://its-me-abhishek.github.io/ccsync-docs/', zulipURL: 'https://ccextractor.org/public/general/support/',