-
Notifications
You must be signed in to change notification settings - Fork 16
chore: allow subgraph endpoint override via env var #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,16 +15,17 @@ const SUBGRAPH_KEY = process.env.NEXT_PUBLIC_SUBGRAPH_API_KEY; | |
| const SUBGRAPH_ID = | ||
| process.env.NEXT_PUBLIC_SUBGRAPH_ID || | ||
| "FE63YgkzcpVocxdCEyEYbvjYqEf2kb1A6daMYRxmejYC"; | ||
| const SUBGRAPH_URL_OVERRIDE = process.env.NEXT_PUBLIC_SUBGRAPH_ENDPOINT; | ||
|
|
||
| // Check for required environment variables. | ||
| if (!INFURA_KEY || !NETWORK) { | ||
| throw new Error( | ||
| `NEXT_PUBLIC_INFURA_KEY and NETWORK must be defined environment variables` | ||
| ); | ||
| } | ||
| if (!SUBGRAPH_KEY) { | ||
| if (!SUBGRAPH_KEY && !SUBGRAPH_URL_OVERRIDE) { | ||
| throw new Error( | ||
| `NEXT_PUBLIC_SUBGRAPH_API_KEY must be defined environment variables` | ||
| `NEXT_PUBLIC_SUBGRAPH_API_KEY (or NEXT_PUBLIC_SUBGRAPH_ENDPOINT override) must be defined environment variables` | ||
| ); | ||
|
Comment on lines
+26
to
29
|
||
| } | ||
|
|
||
|
|
@@ -153,7 +154,9 @@ export const CHAIN_INFO = { | |
| nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, | ||
| rpcUrl: INFURA_NETWORK_URLS[chain.mainnet.id], | ||
| }, | ||
| subgraph: `https://gateway.thegraph.com/api/${SUBGRAPH_KEY}/subgraphs/id/${SUBGRAPH_ID}`, | ||
| subgraph: | ||
| SUBGRAPH_URL_OVERRIDE || | ||
| `https://gateway.thegraph.com/api/${SUBGRAPH_KEY}/subgraphs/id/${SUBGRAPH_ID}`, | ||
| contracts: MAINNET_CONTRACTS, | ||
| }, | ||
| // TODO this needs to be updated | ||
|
|
@@ -169,6 +172,7 @@ export const CHAIN_INFO = { | |
| rpcUrl: INFURA_NETWORK_URLS[chain.goerli.id], | ||
| }, | ||
| subgraph: | ||
| SUBGRAPH_URL_OVERRIDE || | ||
| "https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-goerli", | ||
| contracts: ARBITRUM_GOERLI_CONTRACTS, | ||
| }, | ||
|
|
@@ -185,7 +189,9 @@ export const CHAIN_INFO = { | |
| nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, | ||
| rpcUrl: "https://arb1.arbitrum.io/rpc", | ||
| }, | ||
| subgraph: `https://gateway.thegraph.com/api/${SUBGRAPH_KEY}/subgraphs/id/${SUBGRAPH_ID}`, | ||
| subgraph: | ||
| SUBGRAPH_URL_OVERRIDE || | ||
| `https://gateway.thegraph.com/api/${SUBGRAPH_KEY}/subgraphs/id/${SUBGRAPH_ID}`, | ||
| contracts: ARBITRUM_ONE_CONTRACTS, | ||
| }, | ||
| [chain.arbitrumGoerli.id]: { | ||
|
|
@@ -206,6 +212,7 @@ export const CHAIN_INFO = { | |
| rpcUrl: "https://goerli-rollup.arbitrum.io/rpc", | ||
| }, | ||
| subgraph: | ||
| SUBGRAPH_URL_OVERRIDE || | ||
| "https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-goerli", | ||
| contracts: ARBITRUM_GOERLI_CONTRACTS, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message uses plural "environment variables" when referring to a requirement that only one of the two variables needs to be defined. Consider changing to "must be defined as an environment variable" for grammatical correctness.