Documentation
¶
Index ¶
- Constants
- func GetBool(key string) bool
- func GetBoolOrDefault(key string, defaultValue bool) bool
- func GetBoolOrError(key string) (bool, error)
- func GetBoolOrPanic(key string) bool
- func GetFloat(key string) float64
- func GetFloat64(key string) float64
- func GetFloat64OrDefault(key string, defaultValue float64) float64
- func GetFloat64OrError(key string) (float64, error)
- func GetFloat64OrPanic(key string) float64
- func GetFloatOrDefault(key string, defaultValue float64) float64
- func GetFloatOrError(key string) (float64, error)
- func GetFloatOrPanic(key string) float64
- func GetInt(key string) int
- func GetIntOrDefault(key string, defaultValue int) int
- func GetIntOrError(key string) (int, error)
- func GetIntOrPanic(key string) int
- func GetString(key string) string
- func GetStringOrDefault(key string, defaultValue string) string
- func GetStringOrError(key string) (string, error)
- func GetStringOrPanic(key string) string
- func Load(envFilePath ...string)
- func LoadVault(options struct{ ... }) error
Constants ¶
const ( // True values // - "true", "True", "TRUE" // - "T", "t" // - "1" (as well as any other positive number) // - 0.01 (as well as any other positive float) // - "yes", "Yes", "YES" // - "on", "On", "ON" TrueValues = "true,True,TRUE,T,t,1,yes,Yes,YES,on,On,ON" // False values // - "false", "False", "FALSE" // - "F", "f" // - "0", (as well as any other negative number) // - 0.00 (as well as any other negative float) // - "off", "Off", "OFF" FalseValues = "false,False,FALSE,F,f,0,no,No,NO,off,Off,OFF" )
Variables ¶
This section is empty.
Functions ¶
func GetBool ¶ added in v0.4.0
GetBool retrieves the boolean value of an environment variable. It returns false if the key is not found or the value is not a valid boolean.
func GetBoolOrDefault ¶ added in v0.4.0
GetBoolOrDefault retrieves the boolean value of an environment variable with a default.
func GetBoolOrError ¶ added in v0.4.0
GetBoolOrError retrieves the boolean value of an environment variable, returning an error if the key is not found or the value is not a valid boolean.
func GetBoolOrPanic ¶ added in v0.4.0
GetBoolOrPanic retrieves the boolean value of an environment variable, panicking if not set or on parsing error.
func GetFloat ¶ added in v0.4.0
GetFloat retrieves the float64 value of an environment variable. It returns 0.0 if the key is not found or the value is not a valid float.
func GetFloat64 ¶ added in v0.4.0
GetFloat64 retrieves the float64 value of an environment variable. It returns 0.0 if the key is not found or the value is not a valid float64.
func GetFloat64OrDefault ¶ added in v0.4.0
GetFloat64OrDefault retrieves the float64 value of an environment variable with a default.
func GetFloat64OrError ¶ added in v0.4.0
GetFloat64OrError retrieves the float64 value of an environment variable, returning an error if the key is not found or the value is not a valid float64.
func GetFloat64OrPanic ¶ added in v0.4.0
GetFloat64OrPanic retrieves the float64 value of an environment variable, panicking if not set or on parsing error.
func GetFloatOrDefault ¶ added in v0.4.0
GetFloatOrDefault retrieves the float64 value of an environment variable with a default.
func GetFloatOrError ¶ added in v0.4.0
GetFloatOrError retrieves the float64 value of an environment variable, returning an error if the key is not found or the value is not a valid float.
func GetFloatOrPanic ¶ added in v0.4.0
GetFloatOrPanic retrieves the float64 value of an environment variable, panicking if not set or on parsing error.
func GetInt ¶ added in v0.4.0
GetInt retrieves the integer value of an environment variable. It returns 0 if the key is not found or the value is not a valid integer.
func GetIntOrDefault ¶ added in v0.4.0
GetIntOrDefault retrieves the integer value of an environment variable with a default.
func GetIntOrError ¶ added in v0.4.0
GetIntOrError retrieves the integer value of an environment variable, returning an error if the key is not found or the value is not a valid integer.
func GetIntOrPanic ¶ added in v0.4.0
GetIntOrPanic retrieves the integer value of an environment variable, panicking if not set or on parsing error.
func GetString ¶ added in v0.4.0
GetString retrieves the string value of an environment variable. It returns an empty string if the key is not found.
func GetStringOrDefault ¶ added in v0.4.0
GetStringOrDefault retrieves the string value of an environment variable with a default.
func GetStringOrError ¶ added in v0.4.0
GetStringOrError retrieves the string value of an environment variable, returning an error if the key is not found.
func GetStringOrPanic ¶ added in v0.4.0
GetStringOrPanic retrieves the string value of an environment variable, panicking if not set.
func Load ¶ added in v0.4.0
func Load(envFilePath ...string)
Load loads environment variables from .env files.
If no paths are provided, it will try to load the default .env file.
Parameters:
...envFilePath: The paths to the .env files to load.
Returns:
None.
func LoadVault ¶ added in v0.4.0
LoadVault loads environment variables from an encrypted vault file or from vault content using the provided password.
Parameters:
Password: The password to use for decrypting the vault file or vault content. VaultFilePath: The path to the vault file to load. VaultContent: The content of the vault to load.
Returns:
An error if loading fails.
Types ¶
This section is empty.