22 lines
711 B
TypeScript
22 lines
711 B
TypeScript
/**
|
|
* Helper to determine which backend URL to use based on Playwright worker index.
|
|
* Each worker gets its own backend instance and database.
|
|
*/
|
|
|
|
/**
|
|
* Get the backend URL for the current Playwright worker.
|
|
* Uses NEXT_PUBLIC_API_URL which is set in setup.ts based on worker index.
|
|
* Falls back to environment variable or default port 8001.
|
|
*/
|
|
export function getBackendUrl(): string {
|
|
// NEXT_PUBLIC_API_URL is set in setup.ts based on worker index
|
|
return process.env.NEXT_PUBLIC_API_URL || "http://localhost:8001";
|
|
}
|
|
|
|
/**
|
|
* Get the API URL for the current worker.
|
|
* This is the same as getBackendUrl but with a clearer name.
|
|
*/
|
|
export function getApiUrl(): string {
|
|
return getBackendUrl();
|
|
}
|