Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(names ...string) (map[string]string, error)

    Get environment variables.

    func GetOrDefaultBool

    func GetOrDefaultBool(envVar string, defaultValue bool) bool

      GetOrDefaultBool returns the given environment variable value as a boolean. Returns the default if the envvar cannot be coopered to a boolean, or is not found.

      func GetOrDefaultInt

      func GetOrDefaultInt(envVar string, defaultValue int) int

        GetOrDefaultInt returns the given environment variable value as an integer. Returns the default if the envvar cannot be coopered to an int, or is not found.

        func GetOrDefaultSecond

        func GetOrDefaultSecond(envVar string, defaultValue time.Duration) time.Duration

          GetOrDefaultSecond returns the given environment variable value as an time.Duration (second). Returns the default if the envvar cannot be coopered to an int, or is not found.

          func GetOrDefaultString

          func GetOrDefaultString(envVar, defaultValue string) string

            GetOrDefaultString returns the given environment variable value as a string. Returns the default if the envvar cannot be find.

            func GetOrFile

            func GetOrFile(envVar string) string

              GetOrFile Attempts to resolve 'key' as an environment variable. Failing that, it will check to see if '<key>_FILE' exists. If so, it will attempt to read from the referenced file to populate a value.

              func GetWithFallback

              func GetWithFallback(groups ...[]string) (map[string]string, error)

                GetWithFallback Get environment variable values. The first name in each group is use as key in the result map.

                case 1:

                // LEGO_ONE="ONE"
                // LEGO_TWO="TWO"
                env.GetWithFallback([]string{"LEGO_ONE", "LEGO_TWO"})
                // => "LEGO_ONE" = "ONE"
                

                case 2:

                // LEGO_ONE=""
                // LEGO_TWO="TWO"
                env.GetWithFallback([]string{"LEGO_ONE", "LEGO_TWO"})
                // => "LEGO_ONE" = "TWO"
                

                case 3:

                // LEGO_ONE=""
                // LEGO_TWO=""
                env.GetWithFallback([]string{"LEGO_ONE", "LEGO_TWO"})
                // => error
                

                Types

                This section is empty.

                Source Files