config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Configuration configuration

Configuration contains all active settings

Functions

func SetBinding

func SetBinding(ptr interface{}, f *pflag.Flag)

SetBinding registers a particular Flag as tied to a particular pointer

func SetValue

func SetValue(ptr interface{}, value interface{})

SetValue takes a ptr and updates the value of the flag that's pointing to it

Types

type Setting

type Setting struct {
	Key          string
	Description  string
	Value        string
	DefaultValue string
}

Setting contains string only command line arguments in Key=>Next form

type Settings

type Settings map[string]*Setting

Settings stores all the command line arguments with values

func LoadSettings

func LoadSettings(args []string) (Settings, error)

LoadSettings loads the settings from commandline and the required config file

func ParseCommandLine

func ParseCommandLine(arguments []string) (Settings, error)

ParseCommandLine takes an array of string and turns them into keyvalue pairs

func ParseConfigBuffer

func ParseConfigBuffer(in io.Reader, format string) (Settings, error)

ParseConfigBuffer reads config from a generic Reader

func ParseConfigFile

func ParseConfigFile(configFileName string) (Settings, error)

ParseConfigFile reads the file using Viper

func (Settings) FilterNamespaces

func (settings Settings) FilterNamespaces(nsKeep string) Settings

FilterNamespaces returns a copy of settings belonging to given namespace or no namespace

func (Settings) GetString

func (settings Settings) GetString(name string) (string, bool)

GetString returns value of given commandline flag

func (Settings) RequiredSettingsPresent

func (settings Settings) RequiredSettingsPresent(requiredSettings Settings) error

RequiredSettingsPresent Foo

Jump to

Keyboard shortcuts

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