mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 23:00:57 +00:00
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
/** Runtime configuration, read once so every consumer sees the same values. */
|
|
|
|
const trim = (value: string | undefined, fallback: string) =>
|
|
(value ?? "").trim() || fallback;
|
|
|
|
export const HR_API_URL = trim(
|
|
import.meta.env.VITE_HR_API_URL,
|
|
"http://localhost:3005",
|
|
);
|
|
|
|
/**
|
|
* Where credentials are POSTed. See .env.example — hr-api owns no auth routes,
|
|
* so this points at whichever service hosts the IAM auth controller.
|
|
*/
|
|
export const AUTH_API_URL = trim(
|
|
import.meta.env.VITE_AUTH_API_URL,
|
|
"http://localhost:3001",
|
|
);
|
|
|
|
/**
|
|
* Audience header for the auth host. Required by edr-freight-api's login (it
|
|
* 403s without one); edr-passenger-api neither reads it nor allows it through
|
|
* CORS. Left EMPTY by default so the header is simply not sent — set it only
|
|
* when pointing at an auth host that wants it.
|
|
*/
|
|
export const CLIENT_APP = (import.meta.env.VITE_CLIENT_APP ?? "").trim();
|
|
|
|
/**
|
|
* Base path under AUTH_API_URL where the auth controller lives. It is not the
|
|
* same on every host: edr-freight-api mounts it at `/api/auth/*`, while
|
|
* edr-passenger-api sets no global prefix and serves `/auth/*`. Making it
|
|
* configurable means switching auth hosts is two env vars, not a code change.
|
|
*/
|
|
export const AUTH_BASE_PATH = (import.meta.env.VITE_AUTH_BASE_PATH ?? "/api").trim();
|