environment

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package environment implements functions to read values from environment variables of the OS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string, defaultVal string) string

GetEnv reads a string value from the environment with the given key. If the key is not found, the default value is returned.

func GetEnvBool

func GetEnvBool(key string, defaultVal bool) bool

GetEnvBool reads a string value from the environment with the given key and returns it as bool. If the key is not found or is not a bool, the default value is returned.

func GetEnvFloat32 added in v0.10.0

func GetEnvFloat32(key string, defaultVal float32) float32

GetEnvFloat32 reads a string value from the environment with the given key and returns it as float32. If the key is not found or is not a float32, the default value is returned.

func GetEnvFloat64 added in v0.10.0

func GetEnvFloat64(key string, defaultVal float64) float64

GetEnvFloat64 reads a string value from the environment with the given key and returns it as float64. If the key is not found or is not a float64, the default value is returned.

func GetEnvInt

func GetEnvInt(key string, defaultVal int) int

GetEnvInt reads a string value from the environment with the given key and returns it as int. If the key is not found or is not a int, the default value is returned.

func GetEnvMap added in v0.8.1

func GetEnvMap(prefix string, cutoffPrefix bool) map[string]string

GetEnvMap reads all environment variables with the given prefix. (CAUTION!! Auto attaches the "_" character!!)

It returns a map with all env variables found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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