Environmental Variables

Overview

The AR.IO Gateway allows configuration customization through environmental variables. These variables dictate the gateway's behavior, from block synchronization settings to log formatting. Detailed below is a table enumerating all available environmental variables, their respective types, default values, and a brief description. Note that certain variables, such as SANDBOX_PROTOCOL, rely on others (e.g., ARNS_ROOT_HOST) to function effectively. Ensure proper understanding of these dependencies when configuring.

Variables

ENV NameTypeDefault ValueDescription
GRAPHQL_HOSTStringarweave.netHost for GraphQL queries. You may use any available gateway that supports GQL queries. If omitted, your node can support GQL queries on locally indexed transactions, but only L1 transactions are indexed by default.
GRAPHQL_PORTNumber443Port for GraphQL queries. Used in conjunction with GRAPHQL_HOST to set up the proxy for GQL queries.
START_HEIGHTNumber or "Infinity"0Starting block height for node synchronization (0 = start from genesis block)
STOP_HEIGHTNumber or "Infinity""Infinity"Stop block height for node synchronization (Infinity = keep syncing until stopped)
TRUSTED_NODE_URLString"https://arweave.net"Arweave node to use for fetching data
TRUSTED_GATEWAY_URLString"https://arweave.net"Arweave node to use for proxying reqeusts
TRUSTED_GATEWAYS_URLSStringTRUSTED_GATEWAY_URLA JSON map of gateways and priority
TRUSTED_GATEWAYS_REQUEST_TIMEOUT_MSString"10000"Request timeout in milliseconds for trusted gateways
TRUSTED_ARNS_GATEWAY_URLString"https://__NAME__.arweave.dev"ArNS gateway
WEIGHTED_PEERS_TEMPERATURE_DELTANumber0.1Any positive number above 0, best to keep 1 or less. Used to determine the sensitivity of which the probability of failing or succeeding peers decreases or increases.
INSTANCE_IDString""Adds an "INSTANCE_ID" field to output logs
LOG_FORMATString"simple"Sets the format of output logs, accepts "simple" and "json"
SKIP_CACHEBooleanfalseIf true, skips the local cache and always fetches headers from the node
PORTNumber4000AR.IO node exposed port number
SIMULATED_REQUEST_FAILURE_RATENumber0Number from 0 to 1, representing the probability of a request failing
AR_IO_WALLETString""Arweave wallet address used for staking and rewards
ADMIN_API_KEYStringGeneratedAPI key used for admin API requests (if not set, it is generated and logged into the console)
ADMIN_API_KEY_FILEStringGeneratedAlternative way to set the API key used for admin API requests via filepath, it takes precedence over ADMIN_API_KEY if defined
BACKFILL_BUNDLE_RECORDSBooleanfalseIf true, AR.IO node will start indexing missing bundles
FILTER_CHANGE_REPROCESSBooleanfalseIf true, all indexed bundles will be reprocessed with the new filters (you can use this when you change the filters)
ON_DEMAND_RETRIEVAL_ORDERStrings3,trusted-gateways,chunks,tx-dataData source retrieval order for on-demand data requests
BACKGROUND_RETRIEVAL_ORDERStringchunks,s3,trusted-gateways,chunks,tx-dataData source retrieval order for background data requests (i.e., unbundling)
ANS104_UNBUNDLE_FILTERString{"never": true}Only bundles compliant with this filter will be unbundled
ANS104_INDEX_FILTERString{"never": true}Only bundles compliant with this filter will be indexed
ANS104_DOWNLOAD_WORKERSString5Sets the number of ANS-104 bundles to attempt to download in parallel
ANS104_UNBUNDLE_WORKERSNumber0, or 1 if filters are setSets the number of workers used to handle unbundling
DATA_ITEM_FLUSH_COUNT_THRESHOLDNumber1000Sets the number of new data items indexed before flushing to stable data items
MAX_FLUSH_INTERVAL_SECONDSNumber600Sets the maximum time interval in seconds before flushing to stable data items
WRITE_ANS104_DATA_ITEM_DB_SIGNATURESBooleanfalseIf true, the data item signatures will be written to the database
WRITE_TRANSACTION_DB_SIGNATURESBooleantrueIf true, the transactions signatures will be written to the database
ENABLE_DATA_DB_WAL_CLEANUPBooleanfalseIf true, the data database WAL cleanup worker will be enabled
ENABLE_BACKGROUND_DATA_VERIFICATIONBooleanfalseIf true, unverified data will be verified in background
MAX_DATA_ITEM_QUEUE_SIZENumber100000Sets the maximum number of data items to queue for indexing before skipping indexing new data items
ARNS_ROOT_HOSTStringundefinedDomain name for ArNS host
SANDBOX_PROTOCOLStringundefinedProtocol setting in process of creating sandbox domains in ArNS (ARNS_ROOT_HOST needs to be set for this env to have any effect) accepts "http" or "https"
START_WRITERSBooleantrueIf true, start indexing blocks, tx, ANS104 bundles
RUN_OBSERVERBooleantrueIf true, runs the Observer alongside the gateway to generate Network compliance reports
MIN_RELEASE_NUMBERstring"0"Sets the minimum Gateway release version to check while doing a gateway version assessment
AR_IO_NODE_RELEASEstring"0"Sets the current AR.IO node version to be set on X-AR-IO-Node-Release header on requests to the reference gateway
OBSERVER_WALLETStringundefinedThe public wallet address of the wallet being used to sign report upload transactions for Observer
CHUNKS_DATA_PATHstring"data/chunks"Sets the location for chunked data to be saved. If omitted, chunked data will be stored in the `data` directory
CONTIGUOUS_DATA_PATHstring"data/contiguous"Sets the location for contiguous data to be saved. If omitted, contiguous data will be stored in the `data` directory
HEADERS_DATA_PATHstring"data/headers"Sets the location for header data to be saved. If omitted, header data will be stored in the `data` directory
SQLITE_DATA_PATHstring"data/sqlite"Sets the location for sqlite indexed data to be saved. If omitted, sqlite data will be stored in the `data` directory
DUCKDB_DATA_PATHstring"data/duckdb"Sets the location for duckdb data to be saved. If omitted, duckdb data will be stored in the `data` directory
TEMP_DATA_PATHstring"data/tmp"Sets the location for temporary data to be saved. If omitted, temporary data will be stored in the `data` directory
LMDB_DATA_PATHstring"data/LMDB"Sets the location for LMDB data to be saved. If omitted, LMDB data will be stored in the `data` directory
CHAIN_CACHE_TYPEString"redis"Sets the method for caching chain data, defaults to redis if gateway is started with docker-compose, otherwise defaults to LMDB
REDIS_CACHE_URLString (URL)"redis://localhost:6379"URL of Redis database to be used for caching
REDIS_CACHE_TTL_SECONDSNumber28800TTL value for Redis cache, defaults to 8 hours (28800 seconds)
ENABLE_FS_HEADER_CACHE_CLEANUPBooleanfalseIf true, periodically deletes cached header data
NODE_JS_MAX_OLD_SPACE_SIZENumber2048 or 8192, depending on number of workersSets the memory limit, in Megabytes, for NodeJs. Default value is 2048 if using less than 2 unbundle workers, otherwise 8192
SUBMIT_CONTRACT_INTERACTIONSBooleantrueIf true, Observer will submit its generated reports to the AR.IO Network. If false, reports will be generated but not submitted
REDIS_MAX_MEMORYString256mbSets the max memory allocated to Redis
REDIS_EXTRA_FLAGSString--save "" --appendonly noAdditional CLI flags passed to Redis
WEBHOOK_TARGET_SERVERSStringundefinedTarget servers for webhooks
WEBHOOK_INDEX_FILTERString{"never": true}Only emit webhooks for transactions and data items compliant with this filter
WEBHOOK_BLOCK_FILTERString{"never": true}Only emit webhooks for blocks compliant with this filter
CONTIGUOUS_DATA_CACHE_CLEANUP_THRESHOLDNumberundefinedSets the age threshold in seconds; files older than this are candidates for contiguous data cache cleanup
ENABLE_MEMPOOL_WATCHERBooleanfalseIf true, the gateway will start indexing pending tx from the mempool
MEMPOOL_POLLING_INTERVAL_MSNumber30000Sets the mempool Polling interval, in milliseconds
TAG_SELECTIVITYStringRefer to config.tsA JSON map of tag names to selectivity weights used to order SQLite tag joins
MAX_EXPECTED_DATA_ITEM_INDEXING_INTERVAL_SECONDSNumberundefinedSets the max expected data item indexing interval in seconds
BUNDLE_REPAIR_RETRY_INTERVAL_SECONDSString"300" (5 minutes)Interval in seconds for retrying bundles
BUNDLE_REPAIR_UPDATE_TIMESTAMPS_INTERVAL_SECONDSNumber300 (5 minutes)Interval in seconds for updating timestamps during bundle repair
BUNDLE_REPAIR_BACKFILL_INTERVAL_SECONDSNumber900 (15 minutes)Interval in seconds for backfilling bundles during repair
BUNDLE_REPAIR_FILTER_REPROCESS_INTERVAL_SECONDSNumber300 (5 minutes)Interval in seconds for reprocessing filters during bundle repair
BUNDLE_REPAIR_RETRY_BATCH_SIZEString"1000"Batch size for retrying bundles
APEX_TX_IDStringundefinedIf set, serves this transaction ID's data at the root path (/)
APEX_ARNS_NAMEStringundefinedIf set, resolves and serves this ArNS name's content at the root path (/)
AO_CU_URLStringundefinedURL of the AO CU to be used for interacting with the AO network. If not set, the default CU from FWD research will be used.
NETWORK_AO_CU_URLStringundefinedURL of the AO CU to be used for fetching ARIO network data. If not set, the default CU from FWD research will be used.
AO_MU_URLStringundefinedURL of the AO MU (Memory Unit) to be used. If not set, the default MU from FWD research will be used.
ANT_AO_CU_URLStringAO_CU_URLURL of the AO CU to be used for fetching ANT data. If not set, falls back to AO_CU_URL.
AO_GRAPHQL_URLStringundefinedURL of the AO GraphQL endpoint to be used.
AO_GATEWAY_URLStringundefinedURL of the AO Gateway to be used.
BUNDLE_DATA_IMPORTER_QUEUE_SIZENumber1000The maximum number of bundles to queue for unbundling before skipping
VERIFICATION_DATA_IMPORTER_QUEUE_SIZENumber1000The maximum number of data imports to queue for verification purposes
FS_CLEANUP_WORKER_BATCH_SIZENumber2000The number of files to process in each batch during cleanup
FS_CLEANUP_WORKER_BATCH_PAUSE_DURATIONNumber5000The pause duration between cleanup batches in milliseconds
FS_CLEANUP_WORKER_RESTART_PAUSE_DURATIONNumber14400000 (4 hours)The pause duration before restarting cleanup from the beginning in milliseconds
ARIO_PROCESS_DEFAULT_CIRCUIT_BREAKER_TIMEOUT_MSNumber60000 (60 seconds)Maximum time allowed for requests to AO for ARIO process state. Requests exceeding this timeout are considered failed and may trigger the circuit breaker if the error threshold is reached.
ARIO_PROCESS_DEFAULT_CIRCUIT_BREAKER_ERROR_THRESHOLD_PERCENTAGENumber30Percentage of failed requests to AO for ARIO process state that will trigger the circuit breaker to open. Set to 30% to compensate for extended timeouts.
ARIO_PROCESS_DEFAULT_CIRCUIT_BREAKER_ROLLING_COUNT_TIMEOUT_MSNumber600000 (10 minutes)Time window for tracking errors when retrieving ARIO process state from AO. The circuit breaker counts failures within this rolling window to determine if the error threshold percentage has been exceeded.
ARIO_PROCESS_DEFAULT_CIRCUIT_BREAKER_RESET_TIMEOUT_MSNumber1200000 (20 minutes)Duration the circuit breaker stays in the open state after being triggered. During this period, all requests to AO for ARIO process state will be rejected immediately. After this timeout expires, the circuit breaker transitions to half-open state to test if AO is responsive again.
GATEWAY_PEERS_WEIGHTS_CACHE_DURATION_MSNumber5000 (5 seconds)Duration in milliseconds for which gateway peer weights are cached before being recalculated.
GATEWAY_PEERS_REQUEST_WINDOW_COUNTNumber20Size of the array used to calculate the average performance for peer weighting. A longer window provides a better average but has minimal impact on overall performance.
ARWEAVE_NODE_IGNORE_URLSString (comma-separated)[]Comma-separated list of Arweave node URLs to ignore when selecting peers.
CHUNK_POST_URLSString (comma-separated)TRUSTED_NODE_URL/chunkComma-separated list of URLs for posting chunks received at /chunk endpoint.
CHUNK_POST_CONCURRENCY_LIMITNumber2Maximum number of concurrent chunk POST requests allowed.
CHUNK_POST_MIN_SUCCESS_COUNTString"3"Minimum count of 200 responses for of a given chunk to be considered properly seeded
SECONDARY_CHUNK_POST_URLSString (comma-separated)[]Comma-separated list of additional URLs for posting chunks. These are processed in parallel with primary URLs in a "fire and forget" manner - failures are not blocking.
SECONDARY_CHUNK_POST_CONCURRENCY_LIMITNumber2Maximum number of concurrent secondary chunk POST requests allowed. These are processed independently of primary chunk posting.
SECONDARY_CHUNK_POST_MIN_SUCCESS_COUNTNumber1Minimum number of successful responses required for a chunk to be considered properly seeded on secondary URLs. Failures are not blocking.
CHUNK_POST_RESPONSE_TIMEOUT_MSNumberundefinedTimeout in milliseconds for chunk POST responses. If not set, no timeout is enforced.
CHUNK_POST_ABORT_TIMEOUT_MSNumberundefinedTimeout in milliseconds after which chunk POST requests will be aborted. If not set, no abort timeout is enforced.
AWS_ACCESS_KEY_IDStringundefinedAccess key ID for AWS authentication
AWS_SECRET_ACCESS_KEYStringundefinedSecret access key for AWS authentication
AWS_REGIONStringundefinedAWS region for S3 operations
AWS_ENDPOINTStringundefinedCustom AWS endpoint for S3 operations
AWS_S3_CONTIGUOUS_DATA_BUCKETStringundefinedName of the S3 bucket for storing contiguous data
AWS_S3_CONTIGUOUS_DATA_PREFIXStringundefinedPrefix for contiguous data objects in the S3 bucket
AR_IO_SQLITE_BACKUP_S3_BUCKET_NAMEStringundefinedName of the S3 bucket used for SQLite database backups
AR_IO_SQLITE_BACKUP_S3_BUCKET_REGIONStringundefinedRegion of the S3 bucket used for SQLite database backups
AR_IO_SQLITE_BACKUP_S3_BUCKET_ACCESS_KEYStringundefinedAccess key for the S3 bucket used for SQLite database backups
AR_IO_SQLITE_BACKUP_S3_BUCKET_SECRET_KEYStringundefinedSecret key for the S3 bucket used for SQLite database backups
AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIXStringundefinedPrefix for SQLite database backup objects in the S3 bucket