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

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

  1. Copy this file to .env at your project root:

    cp sample.env .env
    
  2. Fill 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_here
    
  3. Adjust other values as needed for your environment (e.g., testnet vs mainnet).

  4. The application reads these environment variables at startup to configure service connections and logging.


Important Implementation Details


Interactions with Other System Components

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!