denismitr / goenv

Go environment variables helper functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoEnv

Description

Go environment variables helper functions

Usage

Simple strings
foo := goenv.String("SOME_ENV_VAR")
// or
foo := goenv.StringOrDefault("SOME_ENV_VAR", "defaultValue")
// or
foo := MustString("SOME_ENV_VAR") // will panic if not found
Integers
var foo int = goenv.Int("SOME_ENV_VAR")
// or
defaultValue := 5
foo := goenv.IntOrDefault("SOME_ENV_VAR", defaultValue)
// or
foo := MustInt("SOME_ENV_VAR") // will panic if not found
Booleans
var foo bool = goenv.IsTruthy("SOME_ENV_VAR")
// or
foo := goenv.IsFalthy("SOME_ENV_VAR")

About

Go environment variables helper functions


Languages

Language:Go 100.0%