diff --git a/web-app/src/config.ts b/web-app/src/config.ts index 1b62651..e36e364 100644 --- a/web-app/src/config.ts +++ b/web-app/src/config.ts @@ -1,5 +1,3 @@ -import deploymentsLocal from '../../onchain/deployments-local.json'; - const env = import.meta.env; const LOCAL_PONDER_PATH = '/api/graphql'; @@ -16,8 +14,20 @@ interface DeploymentInfrastructure { weth?: string; } -const localContracts = (deploymentsLocal as { contracts?: DeploymentContracts })?.contracts ?? {}; -const localInfra = (deploymentsLocal as { infrastructure?: DeploymentInfrastructure })?.infrastructure ?? {}; +interface DeploymentsLocal { + contracts?: DeploymentContracts; + infrastructure?: DeploymentInfrastructure; +} + +// deployments-local.json is gitignored (local dev only); fall back to empty if absent (CI, production) +const _localFiles = import.meta.glob('../../onchain/deployments-local.json', { + eager: true, + import: 'default', +}); +const deploymentsLocal: DeploymentsLocal = _localFiles['../../onchain/deployments-local.json'] ?? {}; + +const localContracts = deploymentsLocal.contracts ?? {}; +const localInfra = deploymentsLocal.infrastructure ?? {}; const LOCAL_KRAIKEN = (env.VITE_KRAIKEN_ADDRESS ?? localContracts.Kraiken ?? '').trim(); const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim(); const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();