viper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package viper provides a config.Provider based on the Viper configuration library. Since the config.Provider interface was borrowed from Viper, this is a very light package implementation.

The Load implementation not only loads config files from multiple paths, it uses Viper's AutomaticEnv to load config from environment. It also uses SetEnvKeyReplacer to use underscores in place of periods when identifying sub keys via environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() config.Provider

New returns an initialized Viper provider instance.

Types

type Provider

type Provider struct {
	*viper.Viper
}

Provider is a config.Provider for Viper.

func (*Provider) Load

func (p *Provider) Load(name string, paths []string) (config.Settings, error)

Load returns Settings for named configuration loaded from provided paths. Leave the file extension off of name as supported format extensions will automatically be added by Viper.

func (*Provider) New

func (p *Provider) New() config.Settings

New returns an empty Settings instance.

func (*Provider) Sub

func (p *Provider) Sub(key string) config.Settings

Sub returns new Settings instance representing a sub tree of this instance.

Jump to

Keyboard shortcuts

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