mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-19 08:28:10 +02:00
feat: enable remote server deployment for OSS deployment (#57)
This commit is contained in:
parent
ecceeef4d3
commit
6efe7d6bd4
8 changed files with 305 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue