Documentation ¶
Index ¶
- Variables
- func BoD(t time.Time) time.Time
- func Decrypt(encodedData string, secret []byte) (string, error)
- func DirFromSearchPath(searchpath string) (dir *os.File, err error)
- func Encrypt(plainData, secret []byte) (string, error)
- func FileFromSearchPath(searchpath string) (file *os.File, err error)
- func GetDatetime(tstr string) (t time.Time, err error)
- func GetDatetimeInLocation(tstr string, location *time.Location) (t time.Time, err error)
- func GetDecryptedSecret(name string, key []byte) (secret string, err error)
- func GetLast(day time.Weekday) time.Time
- func GetRawSecret(name string) (secret []byte, err error)
- func GetSecret(name string) (secret string, err error)
- func GetWeekday(day string) (time.Weekday, error)
- func IfGetBool(name string, deflt bool) (value bool)
- func IfGetDuration(name string, deflt time.Duration) (value time.Duration)
- func IfGetInt(name string, deflt int) (value int)
- func IfGetRune(name string, deflt rune) (rvalue rune)
- func IfGetenv(name, deflt string) (value string)
- func LoadFromSearchPath(file, searchpath string) (data []byte, err error)
- func MustGetBool(name string) (value bool)
- func MustGetConfig(name string) string
- func MustGetDuration(name string) (value time.Duration)
- func MustGetInt(name string) (value int)
- func MustGetRune(name string, deflt rune) (rvalue rune)
- func MustGetSecret(name string) string
- func MustGetenv(name string) (v string)
- func SetLogger(logger *slog.Logger)
Constants ¶
This section is empty.
Variables ¶
var DecryptionKey string
applications that use encrypted secrets must set this as a package global
Functions ¶
func Decrypt ¶ added in v1.4.0
Decrypt decrypts encodedData string with a secret key and returns plain string.
func DirFromSearchPath ¶
DirFromSearchPath returns the first valid directory in searchpath
func Encrypt ¶ added in v1.4.0
Encrypt encrypts plainData string with a secret key and returns encrypt string.
func FileFromSearchPath ¶
FileFromSearchPath returns first valid file in searchpath
func GetDatetime ¶
GetDatetime attempts to parse a partial time string against formats into time.Time
func GetDatetimeInLocation ¶
GetDatetimeInLocation attempts to parse a partial time string against formats into time.Time in a given time.Location
func GetDecryptedSecret ¶ added in v1.4.0
GetDecryptedSecret returns the decrypted value of an encrypted Docker secret
func GetRawSecret ¶
GetRawSecret returns the raw value of Docker secret
func GetWeekday ¶
GetWeekday returns a time.Weekday parsed from a given day string
func IfGetBool ¶
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 ¶
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 ¶
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 IfGetRune ¶ added in v1.3.1
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 LoadFromSearchPath ¶
LoadFromSearchPath returns the data read from the first valid file in searchpath
func MustGetBool ¶
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 ¶
MustGetConfig returns the value of the Docker secret with name, if it exists; 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 ¶
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 ¶
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
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 ¶
MustGetSecret returns the value of the Docker secret with name; if the secret cannot be read exit with fatal error
func MustGetenv ¶
MustGetenv returns the value of environment variable name; if name is not found exit with fatal error
Types ¶
This section is empty.