sample.env
Overview
The `sample.env` file is a template for environment configuration in the project. It defines key environment variables that configure API keys, endpoints, network settings, and logging levels required by the application to operate within different environments (e.g., development, staging, production). This file serves as a reference for developers and deployment automation to understand which environment variables must be provided and what default endpoints or values can be used.
Typically, `.env` files like `sample.env` are **not** committed with actual secret values but provide a blueprint for required configuration keys. Users create a `.env` file by copying `sample.env` and filling in sensitive information such as API keys.
Purpose and Functionality
Purpose: To specify the environment variables needed for proper configuration of the application, especially for connecting with external services and setting runtime parameters.
Functionality: It outlines:
Secret keys for external services (left empty for security)
URLs for API endpoints and WebSocket connections
Network designation for blockchain or service environment
Logging verbosity level to control debug output
By centralizing this configuration, the app can adapt to different deployment scenarios without modifying code.
Environment Variables Explained
Variable Name | Description | Example Value | Required / Optional |
|---|---|---|---|
`ETHERSCAN_API_KEY` | API key for Etherscan, used for blockchain data queries and verification | (empty in sample) | Required for Etherscan integration |
`INDEXER_API_KEY` | API key for the indexer service, enabling authenticated requests | (empty in sample) | Required if indexer API requires auth |
`RPC_API_KEY` | API key for RPC (Remote Procedure Call) service, typically for blockchain node interaction | (empty in sample) | Required if RPC node authentication is needed |
`INDEXER_URL` | Base HTTP URL for the indexer service gateway | `https://gateway.liquify.com` | Required |
`INDEXER_WS_URL` | WebSocket URL for real-time indexer data streams | `wss://gateway.liquify.com` | Required |
`LOG_LEVEL` | Sets the logging verbosity level for the application (`debug`, `info`, `warn`, `error`) | `debug` | Optional, defaults vary |
`NETWORK` | Specifies the blockchain network environment (`mainnet`, `testnet`, etc.) | `mainnet` | Required |
`RPC_URL` | URL endpoint for the blockchain RPC node | `https://gateway.liquify.com` | Required |
Usage
Copy this file to
.envat your project root:cp sample.env .envFill in your secret API keys:
ETHERSCAN_API_KEY=your_etherscan_api_key_here INDEXER_API_KEY=your_indexer_api_key_here RPC_API_KEY=your_rpc_api_key_hereAdjust other values as needed for your environment (e.g., testnet vs mainnet).
The application reads these environment variables at startup to configure service connections and logging.
Important Implementation Details
Security: Secret keys are deliberately left empty to avoid leaking sensitive credentials in version control.
Service Integration: The URLs provided point to a centralized gateway (
gateway.liquify.com), which likely acts as a proxy or unified endpoint for various services (indexer, RPC).Logging: The
LOG_LEVELvariable controls the verbosity of runtime logs, aiding development and debugging.Network Environment: The
NETWORKvariable configures the application to target the appropriate blockchain environment, affecting how requests are routed and validated.
Interactions with Other System Components
Indexer Service: The
INDEXER_URLandINDEXER_WS_URLvariables configure where the application sends HTTP and WebSocket requests to retrieve indexed blockchain or application data.RPC Node:
RPC_URLandRPC_API_KEYenable interaction with blockchain nodes for querying blockchain state and submitting transactions.Logging Subsystem:
LOG_LEVELinfluences the logging module behavior across the entire app.Security/Secrets Management: Secret keys are injected into the runtime environment, potentially sourced from secure vaults or CI/CD pipelines.
This .env file acts as a bridge between the application code and its external dependencies, providing flexible configuration without source changes.
Visual Diagram
Since this file is a configuration utility file with no classes or functions, the best representation is a **flowchart** showing how these environment variables relate to different services and application components.
flowchart LR
subgraph sample.env
A[ETHERSCAN_API_KEY]
B[INDEXER_API_KEY]
C[RPC_API_KEY]
D[INDEXER_URL]
E[INDEXER_WS_URL]
F[LOG_LEVEL]
G[NETWORK]
H[RPC_URL]
end
subgraph Application
App[Application Core]
Logger[Logging Subsystem]
IndexerService[Indexer Service Client]
RPCService[RPC Service Client]
EtherscanService[Etherscan Client]
end
A -->|authenticates| EtherscanService
B -->|authenticates| IndexerService
C -->|authenticates| RPCService
D -->|connects to| IndexerService
E -->|connects to| IndexerService
H -->|connects to| RPCService
F -->|configures| Logger
G -->|configures| App
App --> IndexerService
App --> RPCService
App --> EtherscanService
App --> Logger
Summary
`sample.env` is a foundational configuration template that defines the environment variables essential for service authentication, endpoint specification, logging, and network selection. It enables the application to interact securely and correctly with external blockchain services and internal logging mechanisms. By customizing and providing this configuration, deployments can be tailored for different environments without code modifications.
If you need further assistance on how to integrate or secure these environment variables, or usage examples in the application code, please ask!