config

package
v0.0.0-...-0356a80 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(key string) bool

Exists confirms if the the key exists

func GetBool

func GetBool(key string, defaultValue bool) bool

GetBool gets the boolean value or defaults as required

func GetDuration

func GetDuration(key string, defaultDuration time.Duration) time.Duration

GetDuration provides additional valiation on top of the standard library because Viper returned zero duraction which could cause significant performance issues

func GetInt

func GetInt(key string, defaultNumber int) int

GetInt gets the value from Viper

func GetString

func GetString(key, defaultValue string) string

GetString gets the value from Viper

func GetStrings

func GetStrings(key string, defaultValues []string) []string

GetStrings gets a list of values

func GetUint

func GetUint(key string, defaultNumber uint) uint

GetUint gets the value from Viper

Types

type Configurator

type Configurator struct {
	Env       string
	Location  string
	Fs        afero.Fs
	Extension string
}

Configurator sets up configuration in production

func NewConfigurator

func NewConfigurator(env, location string, fs afero.Fs) *Configurator

NewConfigurator gets a new production configurator

func (*Configurator) Load

func (c *Configurator) Load()

Load loads without a callback

type IConfigurator

type IConfigurator interface {
	Load()
}

IConfigurator interface for injectiong configuration set up

Jump to

Keyboard shortcuts

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