fix: handle missing deployments-local.json in CI/production
Use import.meta.glob with eager loading instead of a static import so config.ts degrades gracefully when the file is absent (gitignored). Fixes the node-quality CI failure introduced when the file was removed from the repo in this PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de8cf65d06
commit
282ac72c14
1 changed files with 14 additions and 4 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
import deploymentsLocal from '../../onchain/deployments-local.json';
|
|
||||||
|
|
||||||
const env = import.meta.env;
|
const env = import.meta.env;
|
||||||
|
|
||||||
const LOCAL_PONDER_PATH = '/api/graphql';
|
const LOCAL_PONDER_PATH = '/api/graphql';
|
||||||
|
|
@ -16,8 +14,20 @@ interface DeploymentInfrastructure {
|
||||||
weth?: string;
|
weth?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const localContracts = (deploymentsLocal as { contracts?: DeploymentContracts })?.contracts ?? {};
|
interface DeploymentsLocal {
|
||||||
const localInfra = (deploymentsLocal as { infrastructure?: DeploymentInfrastructure })?.infrastructure ?? {};
|
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<DeploymentsLocal>('../../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_KRAIKEN = (env.VITE_KRAIKEN_ADDRESS ?? localContracts.Kraiken ?? '').trim();
|
||||||
const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim();
|
const LOCAL_STAKE = (env.VITE_STAKE_ADDRESS ?? localContracts.Stake ?? '').trim();
|
||||||
const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();
|
const LOCAL_LM = (env.VITE_LIQUIDITY_MANAGER ?? localContracts.LiquidityManager ?? '').trim();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue