fix(web): prevent public bundle localhost api fallback
This commit is contained in:
parent
db29a3f6b9
commit
5ba315fd02
@ -50,8 +50,9 @@ services:
|
||||
BYTELYST_PACKAGE_SOURCE: ${BYTELYST_PACKAGE_SOURCE:-vendor}
|
||||
GITEA_NPM_TOKEN: ${GITEA_NPM_TOKEN:-}
|
||||
VITE_PRODUCT_ID: ${VITE_PRODUCT_ID:-invttrdg}
|
||||
VITE_PLATFORM_URL: ${VITE_PLATFORM_URL:-https://api.bytelyst.com/platform/api}
|
||||
VITE_TRADING_API_URL: ${VITE_TRADING_API_URL:-https://api.bytelyst.com/invttrdg}
|
||||
# Public web builds must use the hosted APIs even if local .env contains dev localhost values.
|
||||
VITE_PLATFORM_URL: https://api.bytelyst.com/platform/api
|
||||
VITE_TRADING_API_URL: https://api.bytelyst.com/invttrdg
|
||||
VITE_BACKTEST_ENABLED: ${VITE_BACKTEST_ENABLED:-true}
|
||||
container_name: invttrdg-web
|
||||
ports:
|
||||
|
||||
@ -27,7 +27,7 @@ export function getRuntimeEnvironment(surface: ProductSurface): RuntimeEnvironme
|
||||
readEnv(`${surfacePrefix}PLATFORM_URL`) ??
|
||||
readEnv('VITE_PLATFORM_URL') ??
|
||||
readEnv('PLATFORM_API_URL') ??
|
||||
'http://localhost:4003/api';
|
||||
(surface === 'web' ? 'https://api.bytelyst.com/platform/api' : 'http://localhost:4003/api');
|
||||
|
||||
// Web code appends /api/... itself — no /api suffix in the base URL.
|
||||
// Mobile code expects /api included and strips it for socket (EXPO_PUBLIC_TRADING_API_URL=http://host:port/api).
|
||||
@ -36,7 +36,9 @@ export function getRuntimeEnvironment(surface: ProductSurface): RuntimeEnvironme
|
||||
readEnv(`${surfacePrefix}TRADING_API_URL`) ??
|
||||
readEnv('VITE_TRADING_API_URL') ??
|
||||
readEnv('TRADING_API_URL') ??
|
||||
`http://localhost:${productConfig.backendPort}`;
|
||||
(surface === 'web'
|
||||
? 'https://api.bytelyst.com/invttrdg'
|
||||
: `http://localhost:${productConfig.backendPort}`);
|
||||
|
||||
return {
|
||||
productId,
|
||||
@ -44,4 +46,3 @@ export function getRuntimeEnvironment(surface: ProductSurface): RuntimeEnvironme
|
||||
tradingApiUrl,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ import { createTradingKillSwitchClient, createTradingWebTelemetry } from '../../
|
||||
// Read Vite env vars via import.meta.env (not process.env — Vite does not inject those in the browser bundle)
|
||||
export const tradingRuntime = {
|
||||
productId: (import.meta.env.VITE_PRODUCT_ID as string) || 'invttrdg',
|
||||
platformApiUrl: (import.meta.env.VITE_PLATFORM_URL as string) || 'http://localhost:4003/api',
|
||||
tradingApiUrl: (import.meta.env.VITE_TRADING_API_URL as string) || 'http://localhost:4018',
|
||||
platformApiUrl: (import.meta.env.VITE_PLATFORM_URL as string) || 'https://api.bytelyst.com/platform/api',
|
||||
tradingApiUrl: (import.meta.env.VITE_TRADING_API_URL as string) || 'https://api.bytelyst.com/invttrdg',
|
||||
};
|
||||
|
||||
export const tradingKillSwitchClient = createTradingKillSwitchClient('web');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user