sample.env
Overview
The `sample.env` file is a template configuration file defining environment variables used to configure the behavior of the application. It primarily holds sensitive secret keys and general environment settings that control API access, network selection, logging verbosity, and connection URLs.
This file does **not** contain executable code but serves as a reference for developers and deployment pipelines to set up the necessary environment variables for the application to run correctly.
Detailed Explanation
Purpose of Environment Variables in sample.env
Environment variables are key-value pairs used to configure applications without hardcoding sensitive information or environment-specific settings into the source code. This approach improves security, flexibility, and ease of deployment across different environments (development, staging, production).
Variables in sample.env
Secret Environment Variables
These variables typically hold sensitive API keys and should never be committed with actual values into public repositories.
Variable | Description | Example Value |
|---|---|---|
`ETHERSCAN_API_KEY` | API key for interacting with Etherscan API, used for blockchain data querying. | `your-etherscan-key-here` |
`INDEXER_API_KEY` | API key for accessing the Liquify indexer service. | |
`RPC_API_KEY` | API key for authenticating with the RPC provider. |
**Usage Note:** Populate these keys with the actual secrets in a `.env` file or via environment variables in your hosting environment.
General Environment Variables
Variable | Description | Example Value |
|---|---|---|
`INDEXER_URL` | URL endpoint for the Liquify indexer REST API. | `https://gateway.liquify.com` |
`INDEXER_WS_URL` | WebSocket URL endpoint for real-time Liquify indexer events. | `wss://gateway.liquify.com` |
`LOG_LEVEL` | Defines logging verbosity. Common values: `debug`, `info`, `warn`, `error`. | `debug` |
`NETWORK` | Blockchain network to connect to (e.g., mainnet, testnet). | |
`RPC_URL` | URL endpoint for the blockchain RPC provider. | `https://gateway.liquify.com` |
How to Use This File
Copy
sample.envto.envcp sample.env .envSet actual secret values
Replace the empty values for
ETHERSCAN_API_KEY,INDEXER_API_KEY, andRPC_API_KEYwith your actual API keys. These keys should be kept confidential.Configure other environment variables as needed
Adjust URLs, network, and log level according to your deployment environment.
Load environment variables in your application
Use libraries such as
dotenv(Node.js), or native environment variable loading mechanisms in your runtime environment to load these variables.
Implementation Details and Usage Considerations
The file uses a simple
KEY=VALUEformat without quotes.Secret keys are intentionally left blank in this template to prevent accidental leakage.
Environment variables like
INDEXER_WS_URLindicate the application supports WebSocket connections for real-time data.LOG_LEVELset todebugmeans the application will log detailed information, useful for development but potentially too verbose for production.NETWORKdetermines which blockchain network the app interacts with, affecting endpoint URLs and transaction parameters.Since URLs and API keys are centralized here, changing environments (e.g., from staging to production) is as simple as switching
.envfiles.
Interaction with the System/Application
This file configures external API integrations (Etherscan, Liquify Indexer, RPC provider).
It influences the behavior of network connections (REST and WebSocket) and logging.
The application likely reads these variables at startup to initialize its clients, services, and logging modules.
Other parts of the system depend on these variables for:
Blockchain data retrieval and transaction submission.
Real-time event streaming.
Debugging and monitoring.
Visual Diagram
flowchart TD
A[sample.env] --> B[Secret API Keys]
A --> C[General Configurations]
B -->|ETHERSCAN_API_KEY| D[Etherscan API Client]
B -->|INDEXER_API_KEY| E[Liquify Indexer Service]
B -->|RPC_API_KEY| F[Blockchain RPC Client]
C -->|INDEXER_URL| E
C -->|INDEXER_WS_URL| G[WebSocket Connection]
C -->|LOG_LEVEL| H[Logging Module]
C -->|NETWORK| I[Network Selector]
C -->|RPC_URL| F
E -->|Real-time Events| G
F -->|Blockchain Calls| I
Explanation:
The
sample.envfile provides secret keys and general configurations.Secret keys feed into respective service clients.
URLs and network settings configure how these clients connect.
Logging level configures the verbosity of logs.
WebSocket URL enables real-time event streaming.
The network selector determines the blockchain environment for operations.
Summary
`sample.env` serves as a foundational configuration template for the application, defining both sensitive authentication keys and essential operational parameters. Proper setup and protection of this file are critical to ensure secure and reliable application behavior across different deployment environments.