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.

your-indexer-key-here

`RPC_API_KEY`

API key for authenticating with the RPC provider.

your-rpc-api-key-here

**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).

mainnet

`RPC_URL`

URL endpoint for the blockchain RPC provider.

`https://gateway.liquify.com`


How to Use This File

  1. Copy sample.env to .env

    cp sample.env .env
    
  2. Set actual secret values

    Replace the empty values for ETHERSCAN_API_KEY, INDEXER_API_KEY, and RPC_API_KEY with your actual API keys. These keys should be kept confidential.

  3. Configure other environment variables as needed

    Adjust URLs, network, and log level according to your deployment environment.

  4. 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


Interaction with the System/Application


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

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.