feat: enable remote server deployment for OSS deployment (#57)

This commit is contained in:
Sabiha Khan 2025-11-20 21:33:05 +05:30 committed by GitHub
parent ecceeef4d3
commit 6efe7d6bd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 305 additions and 4 deletions

View file

@ -3,9 +3,15 @@ import type { CreateClientConfig } from '@/client/client.gen';
export const createClientConfig: CreateClientConfig = (config) => {
// Use different URLs for server-side vs client-side
const isServer = typeof window === 'undefined';
const baseUrl = isServer
? process.env.BACKEND_URL || process.env.NEXT_PUBLIC_BACKEND_URL
: process.env.NEXT_PUBLIC_BACKEND_URL;
let baseUrl: string;
if (isServer) {
// for server-side rendering, still use environment variable as fallback
baseUrl = process.env.BACKEND_URL || 'http://api:8000';
} else {
// for client-side, use the current browser URL's origin
baseUrl = process.env.NEXT_PUBLIC_BACKEND_URL || window.location.origin;
}
return {
...config,