sample.env


Overview

The `sample.env` file is a configuration environment file used to define and store endpoint URLs for accessing various Thorchain daemon services in a development environment. It primarily provides connection strings for different API endpoints related to Thorchain nodes, including RESTful LCD (Light Client Daemon) endpoints, RPC (Remote Procedure Call) endpoints, and WebSocket endpoints. This file serves as a centralized place to manage environment-specific URLs for Thorchain services, enabling other parts of the system to dynamically load and use these URLs for network communication.


Purpose and Functionality


Variables Explained

Variable Name

Description

Example Value

`LCD_URL`

URL of the primary Thorchain LCD (Light Client Daemon) REST API endpoint for the dev environment.

https://dev-daemon.thorchain.shapeshift.com/lcd

`LCD_V1_URL`

URL of the Thorchain LCD REST API endpoint for version 1 of the daemon in the dev environment.

https://dev-daemon.thorchain-v1.shapeshift.com/lcd

`RPC_URL`

URL of the primary Thorchain RPC endpoint for the dev environment.

https://dev-daemon.thorchain.shapeshift.com/rpc

`RPC_V1_URL`

URL of the Thorchain RPC endpoint for version 1 of the daemon in the dev environment.

https://dev-daemon.thorchain-v1.shapeshift.com/rpc

`WS_URL`

WebSocket URL for real-time RPC communication with the Thorchain daemon in the dev environment.

wss://dev-daemon.thorchain.shapeshift.com/rpc


Usage

This file is typically loaded into the environment by tools or scripts before running applications that need to interact with Thorchain services. For example, in a Unix shell, you can load the variables by running:

source sample.env

Then your application or CLI tool can access these URLs via environment variables like `$LCD_URL`, `$RPC_URL`, etc.


Implementation Details


Interaction with Other System Components


Diagram

Since this file is a simple environment configuration file defining key URLs, a flowchart illustrating how these variables are used by different components in the system is most appropriate.

flowchart TD
    subgraph sample.env
        A[LCD_URL]
        B[LCD_V1_URL]
        C[RPC_URL]
        D[RPC_V1_URL]
        E[WS_URL]
    end

    ClientApp1[Client Application] -->|Reads URLs| sample.env
    ClientApp2[Client Application (v1 Support)] -->|Reads URLs| sample.env
    Middleware[Service Middleware] -->|Uses URLs| sample.env
    TestSuite[Testing Framework] -->|Loads URLs| sample.env

    A -->|REST API Calls| ThorchainLCD[Thorchain LCD API]
    B -->|REST API Calls| ThorchainLCDv1[Thorchain LCD v1 API]
    C -->|RPC Calls| ThorchainRPC[Thorchain RPC]
    D -->|RPC Calls| ThorchainRPCv1[Thorchain RPC v1]
    E -->|WebSocket RPC| ThorchainWS[Thorchain WebSocket RPC]

Summary

The `sample.env` file is a straightforward but essential configuration file that defines service endpoints for Thorchain daemon access in development environments. It enables flexibility and maintainability by externalizing critical URLs, supports multiple versions of the daemon, and facilitates different communication protocols (REST, RPC, WebSocket). This file acts as a foundational piece for connecting various system components to the Thorchain network in a consistent and environment-agnostic manner.