settings

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigItemDebug defines the Viper config item for running in debug mode
	ConfigItemDebug = "debug"
	// ConfigItemDryRun defines the Viper config item for enabling dry-run mode
	ConfigItemDryRun = "dry_run"
)

Variables

This section is empty.

Functions

func AddConfigItems

func AddConfigItems(configKeys []string)

AddConfigItems adds a new configuration item, and makes it overridable by env vars

func AddConfigItemsWithPFlags added in v0.2.6

func AddConfigItemsWithPFlags(configKeys []string) error

AddConfigItemsWithFlags adds a new configuration item, as above, but also binds to a PFlag of the same name. NOTE: The PFlag must already have been created with something like:

_ = pflag.String("host", "h", "Host to lookup")

func DryRun

func DryRun() bool

DryRun says whether the dry_run config has been set

Types

type Config added in v0.3.0

type Config struct {
	// File is the default config file name
	File string
	// Dir is an additional directory to search for config files
	Dir string
	// EnvPrefix allows you to add a Viper "EnvPrefix" to config env-vars
	EnvPrefix string
	// UseOnlyDir disables looking for a config file in "$HOME" or "." directories.
	OnlyUseDir bool
}

Config provides the App Config for some of the app-wide settings

func (*Config) Read added in v0.3.0

func (s *Config) Read() error

Read uses Viper to read the configuration from .config.* files or Env Vars

Jump to

Keyboard shortcuts

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