Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

    Config is a type to mirror viper.Config, but with better custom type support. This stems from the closure of github.com/spf13/viper#271.

    func New

    func New(opener Opener, name string, dirs ...string) (*Config, error)

      New returns a Config for the given Config file name (without extension) and list of valid directories for that file to be found in.

      func (*Config) Get

      func (c *Config) Get(k string) interface{}

        Get gets the value at k. If the default value has been set using SetDefault, the data will be converted to the same type as the default value.

        func (*Config) Keys

        func (c *Config) Keys() []string

          Keys returns a list of all keys available in c.

          func (*Config) Set

          func (c *Config) Set(k string, v interface{})

            Set sets the value at k.

            func (*Config) SetDefault

            func (c *Config) SetDefault(k string, v interface{})

              SetDefault sets the type and the default value for the data at k.

              func (*Config) Write

              func (c *Config) Write() error

                Write writes c to the path it was opened from, or the most preferred path path otherwise.

                type Opener

                type Opener interface {
                	Open(path string) (f io.ReadCloser, err error)
                	Create(path string) (f io.WriteCloser, err error)
                }

                  Opener is a type which can read files.

                  Source Files