config

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 8 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoD

func BoD(t time.Time) time.Time

BoD returns returns the time at midnight of the given time

func DirFromSearchPath

func DirFromSearchPath(searchpath string) (dir *os.File, err error)

DirFromSearchPath returns the first valid directory in searchpath

func FileFromSearchPath

func FileFromSearchPath(searchpath string) (file *os.File, err error)

FileFromSearchPath returns first valid file in searchpath

func GetDatetime

func GetDatetime(tstr string) (t time.Time, err error)

GetDatetime attempts to parse a partial time string against formats into time.Time

func GetDatetimeInLocation

func GetDatetimeInLocation(tstr string, location *time.Location) (t time.Time, err error)

GetDatetimeInLocation attempts to parse a partial time string against formats into time.Time in a given time.Location

func GetLast

func GetLast(day time.Weekday) time.Time

GetLast returns time at midnight of the most recent given weekday

func GetRawSecret

func GetRawSecret(name string) (secret []byte, err error)

GetRawSecret returns the raw value of Docker secret name

func GetSecret

func GetSecret(name string) (secret string, err error)

GetSecret returns the value of Docker secret name

func GetWeekday

func GetWeekday(day string) (time.Weekday, error)

GetWeekday returns a time.Weekday parsed from a given day string

func IfGetBool

func IfGetBool(name string, deflt bool) (value bool)

IfGetBool returns the int value of environment variable name; if name is not found or value cannot be parsed as an int return deflt

func IfGetDuration

func IfGetDuration(name string, deflt time.Duration) (value time.Duration)

IfGetDuration returns the time.Duration value of environment variable name; if name is not found or value cannot be parsed as a time.Duration return deflt

func IfGetInt

func IfGetInt(name string, deflt int) (value int)

IfGetInt returns the int value of environment variable name; if name is not found or value cannot be parsed as an int return deflt

func IfGetRun added in v1.3.0

func IfGetRun(name string, deflt rune) (rvalue rune)

IfGetRune returns the rune value of environment variable name; if name is not found or value cannot be parsed as an rune return deflt

func IfGetenv

func IfGetenv(name, deflt string) (value string)

IfGetenv returns the value of environment variable name if found, else deflt

func LoadFromSearchPath

func LoadFromSearchPath(file, searchpath string) (data []byte, err error)

LoadFromSearchPath returns the data read from the first valid file in searchpath

func MustGetBool

func MustGetBool(name string) (value bool)

MustGetBool returns the int value of environment variable name; if name is not found or value cannot be parsed as an int exit with fatal error

func MustGetConfig

func MustGetConfig(name string) string

MustGetConfig returns the value of the Docker secret named $ENV_name, if it exists; if the environment variable ENV is empty or if the secret cannot be read, returns the value of environment variable name; if name is not found in either Docker secrets or as an environment variable, exit with fatal error

func MustGetDuration

func MustGetDuration(name string) (value time.Duration)

MustGetDuration returns the time.Duration value of environment variable name; if name is not found or value cannot be parsed as a time.Duration exit with fatal error

func MustGetInt

func MustGetInt(name string) (value int)

MustGetInt returns the int value of environment variable name; if name is not found or value cannot be parsed as an int exit with fatal error

func MustGetRune added in v1.3.0

func MustGetRune(name string, deflt rune) (rvalue rune)

MustGetRune returns the rune value of environment variable name; if name is not found or value cannot be parsed as an rune return deflt

func MustGetSecret

func MustGetSecret(name string) string

MustGetSecret returns the value of the Docker secret named $ENV_name; if the environment variable ENV is empty or if the secret cannot be read exit with fatal error

func MustGetenv

func MustGetenv(name string) (v string)

MustGetenv returns the value of environment variable name; if name is not found exit with fatal error

Types

This section is empty.

Jump to

Keyboard shortcuts

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