env

package
v0.0.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-2.0 Imports: 4 Imported by: 0

README

Get envs from system


Usage

key := "TEST_ENV"
value := "42"

os.Setenv(key, expectedValue)


getedValue := Get(key).Int(100) // getedValue == 42
getedValue = Get(key).MustInt() // getedValue == 42
getedValue = Get("unseted_key").Int(100) // getedValue == 100
getedValue = Get("unseted_key").MustInt() // panic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

func Get

func Get(key string) *Env

func GetWithOption

func GetWithOption(key string, opts ...Option) *Env

func (*Env) Int

func (e *Env) Int(def int) int

func (*Env) MustInt

func (e *Env) MustInt() int

func (*Env) MustString

func (e *Env) MustString() string

func (*Env) String

func (e *Env) String(def string) string

type Option

type Option func(env *Env) *Env

func WithLogging

func WithLogging(logger logr.Logger) Option

Jump to

Keyboard shortcuts

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