settings

package
v0.1.3417 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFromEnv added in v0.1.3397

func ReadFromEnv(prefix, field string) string

ReadFromEnv takes a prefix and field to search the environment for after capitalizing and joining them with an underscore.

func UserHomeDir

func UserHomeDir() string

UserHomeDir returns the path to the current user's HOME directory.

Types

type Config added in v0.1.3397

type Config struct {
	Client   *client.Client `yaml:"-"`
	Logger   *logger.Logger `yaml:"-"`
	Host     string
	Endpoint string
	Token    string
	Debug    bool   `yaml:"-"`
	Address  string `yaml:"-"`
	FileUsed string `yaml:"-"`
}

Config is used to represent the current state of a CLI instance. It's passed around internally among commands to persist an HTTP client, Logger and other useful data.

func (*Config) Load added in v0.1.3397

func (cfg *Config) Load() error

Load will read the config from the user's disk and then evaluate possible configuration from the environment.

func (*Config) LoadFromDisk added in v0.1.3397

func (cfg *Config) LoadFromDisk() error

LoadFromDisk is used to read config from the user's disk and deserialize the YAML into our runtime config.

func (*Config) LoadFromEnv added in v0.1.3397

func (cfg *Config) LoadFromEnv(prefix string)

LoadFromEnv will read from environment variables of the given prefix for host, endpoint, and token specifically.

func (*Config) WriteToDisk added in v0.1.3397

func (cfg *Config) WriteToDisk() error

WriteToDisk will write the runtime config instance to disk by serializing the YAML

Jump to

Keyboard shortcuts

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