Documentation
¶
Index ¶
- Constants
- func GetAllEnv() ([]string, error)
- func GetEnv(key string) (string, error)
- func GetEnvOrDefault(key, defaultVal string) string
- func GetMode() (string, error)
- func LoadEnv(filenames ...string) error
- func ParseEnvBool(key string) (bool, error)
- func ParseEnvInt(key string) (int, error)
- func ParseEnvTimeDuration(key string) (time.Duration, error)
Constants ¶
View Source
const ( Dev = "dev" Prod = "prod" Staging = "staging" )
Variables ¶
This section is empty.
Functions ¶
func GetEnvOrDefault ¶
Same as GetEnv, but with default value.
func GetMode ¶
Environment variable MODE must be set in .env to call the func. Can be used for dev, prod and staging environments.
func LoadEnv ¶
Loads environment variables from the given files. It is intented to be used in development mode. If in dev mode, make sure to load the env vars first, then call other funcs.
func ParseEnvBool ¶
Gets key's value, calling GetEnv and parses to bool. Assumes it is in a specific format - text or a binary representation.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.