- Use server side rendering in the `getServerEnv` library function, rather than using the API route - Updated `README.md` to list the relevant environment variables for the frontend and backend - Updated `NETWORKING.md` to reflect the changes made in `docker-compose.yaml`
19 lines
529 B
TypeScript
19 lines
529 B
TypeScript
'use server';
|
|
|
|
import process from 'process';
|
|
|
|
export async function getServerEnv(envVar: string): Promise<string> {
|
|
let result: string | undefined;
|
|
switch (envVar) {
|
|
case "BACKEND_API_URL":
|
|
result = process.env.BACKEND_API_URL ?? process.env.NEXT_PUBLIC_API_URL;
|
|
break;
|
|
case "BACKEND_WS_URL":
|
|
result = process.env.BACKEND_WS_URL ?? process.env.NEXT_PUBLIC_WS_URL;
|
|
break;
|
|
default:
|
|
result = process.env[envVar];
|
|
break;
|
|
}
|
|
return result ?? "";
|
|
}
|