env

package
v1.1.48 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enviper

type Enviper struct {
	*viper.Viper
	// contains filtered or unexported fields
}

Enviper is a wrapper struct for viper, that makes it possible to unmarshal config to struct considering environment variables

func New

func New(v *viper.Viper) *Enviper

New returns an initialized Enviper instance

func (*Enviper) TagName

func (e *Enviper) TagName() string

TagName returns currently used tag name (`mapstructure` by default)

func (*Enviper) Unmarshal

func (e *Enviper) Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error

Unmarshal unmarshals the config into a Struct just like viper does. The difference between enviper and viper is in automatic overriding data from file by data from env variables

func (*Enviper) WithTagName

func (e *Enviper) WithTagName(customTagName string) *Enviper

WithTagName sets custom tag name to be used instead of default `mapstructure`

Jump to

Keyboard shortcuts

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