Key Concepts
Environment Variables
Learn how to configure Nexus via environment variables
Introduction
Nexus
allows you to configure the server using environment variables. These variables are used in conjunction with the NexusConfigOptions
interface to configure the Nexus server.
Environment Variables
Below is a table of standard Nexus
environment variables that can be set to configure the Nexus server.
Name | Description | Default | Required | Example |
---|---|---|---|---|
NEXUS_CHAINS | A JSON array of chains. Each chain should have a name , chainId , and blockTime . | See default chains | No | [{"name": "eth_mainnet", "chainId": 1, "blockTime": 12}, [{"name": "base_mainnet", "chainId": 8453, "blockTime": 2}] |
NODE_PROVIDERS | A JSON array of node providers. Each provider should have a name , url , and chainId . Each chainId should refer to either a default chains or a chainId set in the NEXUS_CHAINS environment variable. Node proviers can additionally have an weight field, which defaults to 1 . This value is used for load balancing. | - | Yes | [{"name": "eth.public", "url":"https://eth.public-rpc.com", "chainId": 1}] [{"name": "eth.public", "url":"https://eth.public-rpc.com", "chainId": 1, "weight": 3}, {"name": "tenderly", "url":"", "chainId": 1, "weight": 7}] |
NEXUS_PORT | The port the Nexus server should listen on. | 4000 | No | 4000 |
NEXUS_RPC_AUTH_KEY | The secret key used to authenticate requests to the Nexus server. | - | No | my-secret-key |
NEXUS_RELAY_ORDER | The order in which to cycle through node providers when a request fails. Can be either random or sequential . | sequential | No | random |
NEXUS_RELAY_FAILURE | A string or a JSON array that configures error recovery. Can be set to fail-immediately or ["cycle-requests", <max number of retries>] | ["cycle-requests", 3] | No | ["cycle-requests", 5] |
NEXUS_LOG_LEVEL | The log level for the Nexus server. Can be set to debug , info , warn , or error . | info | No | debug |
NEXUS_LOG_COLORIZE | Whether to colorize the logs. Can be set to true or false . Recommended to set to false on production. | true | No | false |
NEXUS_SUBSCRIPTION_SHARING_ENABLED | Whether to share ethereum subscription rpc calls accross multiple clients | true | No | false |
Was this page helpful?