mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 11:54:46 +00:00
config/cloud-build-defaults.json feeds an ORCA_CLOUD_BUILD_DEFAULTS define in main; packaged builds read no shell env. ORCA_BUILD_BILLING_API_URL / ORCA_BUILD_CLOUD_SANDBOX_URL override at build time, ORCA_BILLING_API_URL / ORCA_CLOUD_SANDBOX_URL at run time. Public endpoints only.
18 lines
915 B
TypeScript
18 lines
915 B
TypeScript
// Packaged builds read no shell env, so the integration build bakes in its backend URLs
|
|
// (config/cloud-build-defaults.json via electron.vite.config.ts). Run-time env still wins.
|
|
declare const ORCA_CLOUD_BUILD_DEFAULTS: { billingApiUrl?: string; cloudSandboxUrl?: string } | null
|
|
|
|
function buildDefaults(): { billingApiUrl?: string; cloudSandboxUrl?: string } {
|
|
// oxlint-disable-next-line unicorn/no-typeof-undefined -- undeclared outside electron-vite builds; a bare read throws.
|
|
return (typeof ORCA_CLOUD_BUILD_DEFAULTS === 'undefined' ? null : ORCA_CLOUD_BUILD_DEFAULTS) ?? {}
|
|
}
|
|
|
|
export function withCloudBuildDefaults(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
const defaults = buildDefaults()
|
|
return {
|
|
...env,
|
|
ORCA_BILLING_API_URL: env.ORCA_BILLING_API_URL?.trim() || defaults.billingApiUrl,
|
|
ORCA_CLOUD_SANDBOX_URL: env.ORCA_CLOUD_SANDBOX_URL?.trim() || defaults.cloudSandboxUrl
|
|
}
|
|
}
|