Documentation ¶
Index ¶
- func Get[V any](key string, parse func(string) (V, error), fallback ...V) (V, error)
- func MustGet[V any](key string, parse func(string) (V, error)) V
- func ParseString(val string) (string, error)
- func ParseStrings(val string) ([]string, error)
- type Envy
- func (e *Envy) Bool(key string, fallback ...bool) bool
- func (e *Envy) Duration(key string, fallback ...time.Duration) time.Duration
- func (e *Envy) Int(key string, fallback ...int) int
- func (e *Envy) String(key string, fallback ...string) string
- func (e *Envy) Strings(key string, fallback ...[]string) []string
- func (e *Envy) WithErrorHandler(errorHandler ErrorHandler) *Envy
- type ErrorHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustGet ¶
MustGet retrieves an environment variable and panics if not found or parsed successfully.
func ParseString ¶
ParseString is a parsing function for string values.
func ParseStrings ¶
ParseStrings is a parsing function for slice of strings.
Types ¶
type Envy ¶
type Envy struct {
// contains filtered or unexported fields
}
Envy is a configuration manager that retrieves environment variables with fallbacks.
func New ¶
func New() *Envy
New creates a new instance of Envy with a default error handler that logs fatal errors.
func (*Envy) WithErrorHandler ¶
func (e *Envy) WithErrorHandler(errorHandler ErrorHandler) *Envy
WithErrorHandler sets a custom error handler for the Envy instance.
Click to show internal directories.
Click to hide internal directories.