sample.env


Overview

The `sample.env` file serves as a template for environment configuration in the application. It defines key environment variables required to connect to external services (such as APIs and RPC endpoints), configure network settings, and control application behavior (like logging verbosity). This file is meant to be copied and customized by users or deployment scripts to provide actual secret keys and service URLs, which the application reads at runtime to configure its operational parameters.

Environment variables stored in `.env`-style files such as `sample.env` are crucial for separating configuration from code, enabling secure management of secrets (e.g., API keys), and allowing different configurations for development, testing, and production environments without modifying source code.


Detailed Explanation of Contents

The `sample.env` file contains two main sections:

1. Secret Environment Variables

These variables hold sensitive information, such as API keys, which are necessary for authenticating with third-party services. They should never be committed with actual values to public repositories.

Variable Name

Description

Example Value (placeholder)

`INDEXER_API_KEY`

API key for accessing the Indexer service.

(empty, to be filled)

`RPC_API_KEY`

API key for RPC (Remote Procedure Call) service access.

(empty, to be filled)

2. Environment Variables

These variables configure URLs, logging level, network selection, and RPC endpoints.

Variable Name

Description

Example Value

`INDEXER_URL`

HTTP URL for the Indexer service endpoint.

`https://gateway.liquify.com`

`INDEXER_WS_URL`

WebSocket URL for the Indexer service, used for real-time updates.

`wss://gateway.liquify.com`

`LOG_LEVEL`

Sets the logging verbosity level (e.g., debug, info, warn, error).

`debug`

`NETWORK`

Specifies the blockchain network environment (e.g., mainnet, testnet).

`mainnet`

`RPC_URL`

HTTP URL for the RPC service endpoint.

`https://gateway.liquify.com`


Usage

How to Use This File

  1. Copy to .env
    Copy sample.env to a new file named .env in the root of your project:

    cp sample.env .env
    
  2. Fill in Secrets
    Populate the secret variables (INDEXER_API_KEY and RPC_API_KEY) with your actual API keys.

  3. Modify Other Variables as Needed
    Adjust URLs, network, and log level according to your environment needs (development, staging, production).

  4. Load Environment Variables
    When the application starts, it typically uses a library like dotenv (in Node.js) or equivalent to load these variables into the process environment.

Example

INDEXER_API_KEY=abcd1234efgh5678
RPC_API_KEY=wxyz9876mnop5432
INDEXER_URL=https://gateway.liquify.com
INDEXER_WS_URL=wss://gateway.liquify.com
LOG_LEVEL=info
NETWORK=mainnet
RPC_URL=https://gateway.liquify.com

Important Implementation Details


Interaction with Other System Components


Visual Diagram: Environment Variable Configuration Flow

flowchart TD
    A[sample.env file] --> B[Application Startup]
    B --> C{Load Environment Variables}
    C -->|INDEXER_API_KEY, RPC_API_KEY| D[Authentication Modules]
    C -->|INDEXER_URL, INDEXER_WS_URL| E[Indexer API Client]
    C -->|RPC_URL| F[RPC Client]
    C -->|LOG_LEVEL| G[Logging Configuration]
    C -->|NETWORK| H[Network Context Setup]

    D --> I[Secure API Requests]
    E --> I
    F --> I

*Diagram Explanation:*


Summary

The `sample.env` file is a crucial configuration template that defines the secrets and environment-specific variables required by the application to connect to external blockchain-related services, set logging verbosity, and select the operating network. Proper setup and management of this file ensure secure and flexible deployment configurations across multiple environments.