os

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoolFromEnvVar

func GetBoolFromEnvVar(name string, defaultValue bool) (bool, error)

GetBoolFromEnvVar attempts to parse a bool from a string value retrieved from the specified environment variable. An error is returned if the string value cannot successfully be parsed as a bool.

func GetDurationFromEnvVar

func GetDurationFromEnvVar(
	name string,
	defaultValue time.Duration,
) (time.Duration, error)

GetDurationFromEnvVar attempts to parse a time.Duration from a string value retrieved from the specified environment variable. An error is returned if the string value cannot successfully be parsed as a time.Duration.

func GetEnvVar

func GetEnvVar(name, defaultValue string) string

GetEnvVar retrieves the value of an environment variable having the specified name. If that value is the empty string, a specified default is returned instead.

func GetIPNetSliceFromEnvVar

func GetIPNetSliceFromEnvVar(
	name string,
	defaultValue []net.IPNet,
) ([]net.IPNet, error)

GetIPNetSliceFromEnvVar retrieves comma-delimited values from an environment variable having the specified name and attempts to parse those into a slice of net.IP.

func GetIntFromEnvVar

func GetIntFromEnvVar(name string, defaultValue int) (int, error)

GetIntFromEnvVar attempts to parse an integer from a string value retrieved from the specified environment variable. An error is returned if the string value cannot successfully be parsed as an integer.

func GetRequiredEnvVar

func GetRequiredEnvVar(name string) (string, error)

GetRequiredEnvVar retrieves the value of an environment variable having the specified name. If that value is the empty string, an error is returned.

func GetRequiredIntFromEnvVar added in v0.3.0

func GetRequiredIntFromEnvVar(name string) (int, error)

GetRequiredIntFromEnvVar attempts to parse an integer from a string value retrieved from the specified environment variable. An error is returned if the string value cannot successfully be parsed as an integer. An error is also returned if the string value was the empty string.

func GetStringSliceFromEnvVar

func GetStringSliceFromEnvVar(name string, defaultValue []string) []string

GetStringSliceFromEnvVar retrieves comma-delimited values from an environment variable having the specified name and populates a string slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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