Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ViperBuilder ¶
type ViperBuilder struct {
// contains filtered or unexported fields
}
ViperBuilder is a builder to streamline Viper configuration and building.
func (*ViperBuilder) Build ¶
func (vb *ViperBuilder) Build() (*viper.Viper, error)
Build builds the Viper config and returns it. It first extracts a Viper instance for the specific environment it's running in, then explicitly calls BindEnv for each of the attributes of the configuration. This is done to force Viper to be aware of the ENV variables for each of those configuration attributes. The Viper instance returned by this function can be unmarshalled by the caller in a configuration-specific type while respecting the precedence order.
func (*ViperBuilder) ConfigPath ¶
func (vb *ViperBuilder) ConfigPath(path string) *ViperBuilder
ConfigPath sets the path argument as the Viper config path.
func (*ViperBuilder) SetDefault ¶
func (vb *ViperBuilder) SetDefault(key string, value interface{}) *ViperBuilder
SetDefault sets a default value for a configuration key. Any default value set will be available in the `viper.Viper` configuration instance that is returned after calling the `Build()` function.