env

package module
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 3 Imported by: 0

README

Toscale Env

A simple env wrapper developed on top of spf13/viper

Installation

go get github.com/Toscale-platform/toscale-env

Usage

Add your application configuration to your .env file in the root of your project:

TOKEN=ABC
PORT=8080
EXCHANGES=binance,bitfinex
DEBUG=true

Then in your Go app you can do something like:

package main

import (
    env "github.com/Toscale-platform/toscale-env"
)

func main() {
    token := env.GetString("TOKEN")
    port := env.GetInt("PORT")
    exchanges := env.GetSlice("EXCHANGES")
    debug := env.GetBool("DEBUG")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBool

func GetBool(key string) bool

func GetInt

func GetInt(key string) int

func GetSlice

func GetSlice(key string) []string

func GetString

func GetString(key string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL