config

package
v0.0.0-...-06ecd44 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package config implements a tiny wrapper around Viper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ViperConfig

type ViperConfig struct {
	*viper.Viper
}

ViperConfig is a wrapper for viper.Viper.

func NewWrapper

func NewWrapper(v *viper.Viper) *ViperConfig

NewWrapper returns a *ViperConfig for the provided *viper.Viper.

func (*ViperConfig) BindConfig

func (v *ViperConfig) BindConfig(key string)

BindConfig is a shortcut for the viper.SetDefault/viper.BindEnv pattern. It uses the provided key to perform the following on the underlying viper.Viper: * The default is set to nil. * The key is bound to an environment variable that matches the key, uppercased. Panics if the binding fails.

func (*ViperConfig) BindConfigAndOverrideEnvVar

func (v *ViperConfig) BindConfigAndOverrideEnvVar(key string, envVarNameOverride string)

BindConfigAndOverrideEnvVar is a shortcut for the viper.SetDefault/viper.BindEnv pattern. It uses the provided key to perform the following on the underlying viper.Viper: * The default is set to nil. * The key is bound to an environment variable, using the provided override. If the override is a zero-value string, it will use the envvar name matching the key, uppercased (i.e. the same behavior as BindConfig). Panics if the binding fails.

Jump to

Keyboard shortcuts

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