config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string) string

Get returns the current configuration value of a key.

If it has no specific value, it falls back to a value of environment variable starting with "FIREWORQ_" and then a default value which is returned from GetDefault.

func GetDefault

func GetDefault(key string) string

GetDefault returns the default configuration value of a key.

func Keys

func Keys() []string

Keys returns a list of configuration keys.

func Locally

func Locally(k, v string, block func())

Locally overrides the current configuration value of a key in a block.

This is not goroutine safe and should only be used in tests.

func Set

func Set(k, v string)

Set sets the current configuration value of a key.

func SetDefault

func SetDefault(k, v string)

SetDefault sets the default configuration value of a key.

Types

type Item

type Item struct {
	Category     string
	Name         string
	DefaultValue string
	Label        string
	Description  string
}

Item describes a configuration key and its default value.

func Descriptions

func Descriptions() []Item

Descriptions returns the default configurations and their descriptions.

func (Item) Argument

func (item Item) Argument() string

Argument returns a representation of the configuration key name as a command line argument.

func (Item) Describe

func (item Item) Describe(indent, width int) string

Describe returns a string representation of the description of configuration key as a command line descripiton, wrapped in the width with indented lines.

Jump to

Keyboard shortcuts

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