diff --git a/scripts/pre-build.ts b/scripts/pre-build.ts index 555c525ec..4ad9d730a 100644 --- a/scripts/pre-build.ts +++ b/scripts/pre-build.ts @@ -10,11 +10,13 @@ import { fetchExclusiveRelayersDynamicWeights, fetchExclusiveRelayersFixedWeights, fetchExclusivityConfig, + fetchGitEnvConfig, getRemoteConfigCommitHash, getBqReaderRemoteBaseUrl, remoteConfigTypes, getAcrossConfigsRemoteBaseUrl, getRelayerConfigsRemoteBaseUrl, + getGitEnvConfigsRemoteBaseUrl, } from "./remote-configs/utils"; dotenv.config({ @@ -101,6 +103,16 @@ const remoteConfigs = { ), localFilePath: "src/data/exclusivity-strategy.json", }, + [remoteConfigTypes.GIT_ENV_CONFIGS]: { + fetchFn: () => + fetchGitEnvConfig( + // Using invalid URL will cause the fetch to fail and fallback to the local file for now. + getGitEnvConfigsRemoteBaseUrl(), + "projects/across/frontend/outputs/output.env", + getRemoteConfigCommitHash(remoteConfigTypes.GIT_ENV_CONFIGS) + ), + localFilePath: "src/data/output.env", + }, }; (async () => { diff --git a/scripts/remote-configs/utils.ts b/scripts/remote-configs/utils.ts index 652524500..30a628039 100644 --- a/scripts/remote-configs/utils.ts +++ b/scripts/remote-configs/utils.ts @@ -29,6 +29,7 @@ export const remoteConfigTypes = { EXCLUSIVE_RELAYERS_FIXED_WEIGHTS: "EXCLUSIVE_RELAYER_WEIGHTS", EXCLUSIVITY_STRATEGY: "EXCLUSIVITY_STRATEGY", RPC_PROVIDERS: "RPC_PROVIDERS", + GIT_ENV_CONFIGS: "GIT_ENV_CONFIGS", } as const; export type RemoteConfig = @@ -117,6 +118,12 @@ export const fetchExclusivityConfig = makeFetchRemoteConfig( exclusivityStrategyFallbackData ); +export const fetchGitEnvConfig = makeFetchRemoteConfig( + type({ + default: string(), + }), +); + function makeFetchRemoteConfig(schema: Struct, fallbackData?: T) { return async ( remoteBaseUrl: string, @@ -208,3 +215,10 @@ export function getAcrossConfigsRemoteBaseUrl() { `https://${GITHUB_HOST}/UMAprotocol/across-configs` ); } + +export function getGitEnvConfigsRemoteBaseUrl() { + return getRemoteConfigBaseUrl( + "GIT_ENV_CONFIGS", + `https://${GITHUB_HOST}/UMAprotocol/git-env` + ); +}