env

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(key string, def types.Address) (v types.Address)

Address returns an address from the environment variable with the given key using types.AddressFromHex.

func Bool

func Bool(key string, def bool) bool

Bool returns a bool from the environment variable with the given key.

func Duration

func Duration(key string, def time.Duration) (v time.Duration)

Duration returns a duration from the environment variable with the given key using time.ParseDuration.

func Float64

func Float64(key string, def float64) float64

func HexBytes

func HexBytes(key string, def []byte) []byte

HexBytes returns a byte slice from the environment variable with the given key using hex.DecodeString.

func HexBytesOfSize

func HexBytesOfSize(key string, l int) ([]byte, error)

func Int

func Int(key string, def int) (v int)

Int returns an int from the environment variable with the given key.

func Int64

func Int64(key string, def int64) int64

func ReaderFromHexOrRandomOfSize

func ReaderFromHexOrRandomOfSize(key string, size int) io.Reader

func SetSeparatorKey

func SetSeparatorKey(s string)

SetSeparatorKey sets the environment variable key to read the separator from.

func String

func String(key, def string) string

String returns a string from the environment variable with the given key. If the variable is not set, the default value is returned. Empty values are allowed and valid.

func Strings

func Strings(key string, def []string) []string

Strings returns a slice of strings from the environment variable with the given key. If the variable is not set, the default value is returned. The value is split by the separator defined in the CFG_ITEM_SEPARATOR. Values are trimmed of the separator before splitting. If the environment variable exists but is empty, an empty slice is returned.

func Uint64

func Uint64(key string, def uint64) uint64

Uint64 returns a uint64 from the environment variable with the given key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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