Files
kandev/apps/web/lib/config.ts
T
Carlos Florêncio bc6a5f28d9 feat: cli launcher npx kandev (#39)
* feat: cli launcher

* feat: improved debug
2026-01-18 20:42:03 +00:00

23 lines
579 B
TypeScript

export type AppConfig = {
apiBaseUrl: string;
};
const DEFAULT_API_BASE_URL = 'http://localhost:8080';
export const DEBUG_UI = process.env.NEXT_PUBLIC_KANDEV_DEBUG === 'true';
export function getBackendConfig(): AppConfig {
if (typeof window === 'undefined') {
return {
apiBaseUrl: process.env.KANDEV_API_BASE_URL ?? DEFAULT_API_BASE_URL,
};
}
if (window.__KANDEV_API_BASE_URL) {
return {
apiBaseUrl: window.__KANDEV_API_BASE_URL,
};
}
return {
apiBaseUrl: process.env.NEXT_PUBLIC_KANDEV_API_BASE_URL ?? DEFAULT_API_BASE_URL,
};
}