Skip to content

feat: Route service API calls through /api proxy instead of hardcoded…#11939

Merged
jamil314 merged 13 commits intodevelopfrom
ocrvs-11898
Mar 5, 2026
Merged

feat: Route service API calls through /api proxy instead of hardcoded…#11939
jamil314 merged 13 commits intodevelopfrom
ocrvs-11898

Conversation

@jamil314
Copy link
Copy Markdown
Contributor

@jamil314 jamil314 commented Feb 27, 2026

Removes hardcoded service URLs (API_GATEWAY_URL, AUTH_URL, CONFIG_API_URL, COUNTRY_CONFIG_URL, AUTH_API_URL) from window.config and replaces all direct service calls with relative /api/* paths routed through the nginx/vite proxy:

  • apolloClient: /api/graphql (was window.config.API_GATEWAY_URL/graphql)
  • client authApi: /api/auth/invalidateToken (was window.config.AUTH_URL)
  • login authApi: /api/auth/authenticate, /api/auth/verifyCode, /api/auth/verifyUser, /api/auth/verifyNumber, /api/auth/verifySecurityAnswer, /api/auth/resendAuthenticationCode, /api/auth/changePassword, /api/auth/sendUserName (were window.config.AUTH_API_URL)
  • login authApi: /api/config/publicConfig (was window.config.CONFIG_API_URL)
  • login referenceApi: /api/countryconfig/content/login (was window.config.COUNTRY_CONFIG_URL)
  • client referenceApi: /api/config/config, /api/config/publicConfig, /api/config/forms (were window.config.CONFIG_API_URL); /api/countryconfig/validators.js, /api/countryconfig/conditionals.js, /api/countryconfig/handlebars.js, /api/countryconfig/content/client (were window.config.COUNTRY_CONFIG_URL)

Also adds explicit /api/auth/ and /api/config/ proxy blocks to both nginx configs and vite dev proxies (previously only /api/ catch-all existed), converts LANGUAGES from comma-separated string to string[] in window.config, and updates all tests and storybook previews accordingly.

ToDo

  • Remove LOGIN_URL

Description

Clearly describe what has been changed. Include relevant context or background.
Explain how the issue was fixed (if applicable) and the root cause.

Link this pull request to the GitHub issue (and optionally name the branch ocrvs-<issue #>)

Checklist

  • I have linked the correct Github issue under "Development"
  • I have tested the changes locally, and written appropriate tests
  • I have tested beyond the happy path (e.g. edge cases, failure paths)
  • I have updated the changelog with this change (if applicable)
  • I have updated the GitHub issue status accordingly

… URLs

Removes hardcoded service URLs (API_GATEWAY_URL, AUTH_URL, CONFIG_API_URL,
COUNTRY_CONFIG_URL, AUTH_API_URL) from window.config and replaces all direct
service calls with relative /api/* paths routed through the nginx/vite proxy:

- apolloClient: /api/graphql (was window.config.API_GATEWAY_URL/graphql)
- client authApi: /api/auth/invalidateToken (was window.config.AUTH_URL)
- login authApi: /api/auth/authenticate, /api/auth/verifyCode,
  /api/auth/verifyUser, /api/auth/verifyNumber, /api/auth/verifySecurityAnswer,
  /api/auth/resendAuthenticationCode, /api/auth/changePassword,
  /api/auth/sendUserName (were window.config.AUTH_API_URL)
- login authApi: /api/config/publicConfig (was window.config.CONFIG_API_URL)
- login referenceApi: /api/countryconfig/content/login (was window.config.COUNTRY_CONFIG_URL)
- client referenceApi: /api/config/config, /api/config/publicConfig,
  /api/config/forms (were window.config.CONFIG_API_URL);
  /api/countryconfig/validators.js, /api/countryconfig/conditionals.js,
  /api/countryconfig/handlebars.js, /api/countryconfig/content/client
  (were window.config.COUNTRY_CONFIG_URL)

Also adds explicit /api/auth/ and /api/config/ proxy blocks to both nginx
configs and vite dev proxies (previously only /api/ catch-all existed),
converts LANGUAGES from comma-separated string to string[] in window.config,
and updates all tests and storybook previews accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 27, 2026

ℹ️ Coverage metrics explained:
Statements — Executed code statements (basic logic lines)
Branches — Tested decision paths (if/else, switch, ternaries)
Functions — Functions invoked during tests
Lines — Source lines executed

@jamil314 jamil314 marked this pull request as draft February 27, 2026 11:03
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 27, 2026

📊 commons test coverage

Statements: 66.94%
Branches:   32.59%
Functions:  49.7%
Lines:      66.39%
Updated at: Thu, 05 Mar 2026 08:59:04 GMT

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 27, 2026

📊 events test coverage

Statements: 86.82%
Branches:   85%
Functions:  93.2%
Lines:      86.82%
Updated at: Thu, 05 Mar 2026 09:01:10 GMT

@jamil314 jamil314 marked this pull request as ready for review March 3, 2026 08:17
@jamil314 jamil314 linked an issue Mar 3, 2026 that may be closed by this pull request
@ocrvs-bot
Copy link
Copy Markdown
Contributor

Your environment is deployed to https://ocrvs-11898.e2e-k8s.opencrvs.dev

@jamil314 jamil314 requested a review from rikukissa March 3, 2026 13:10
@jamil314 jamil314 merged commit af2b33a into develop Mar 5, 2026
151 of 153 checks passed
@jamil314 jamil314 deleted the ocrvs-11898 branch March 5, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up client-config.js and login-config.js

4 participants