fabric: github.com/hyperledger/fabric/common/viperutil Index | Files

package viperutil

import "github.com/hyperledger/fabric/common/viperutil"


Package Files


func ConfigPaths Uses

func ConfigPaths() []string

ConfigPaths returns the paths from environment and defaults which are CWD and /etc/hyperledger/fabric.

type ConfigParser Uses

type ConfigParser struct {
    // contains filtered or unexported fields

ConfigParser holds the configuration file locations. It keeps the config file directory locations and env variables. From the file the config is unmarshalled and stored. Currently "yaml" is supported.

func New Uses

func New() *ConfigParser

New creates a ConfigParser instance

func (*ConfigParser) AddConfigPaths Uses

func (c *ConfigParser) AddConfigPaths(cfgPaths ...string)

AddConfigPaths keeps a list of path to search the relevant config file. Multiple paths can be provided.

func (*ConfigParser) ConfigFileUsed Uses

func (c *ConfigParser) ConfigFileUsed() string

ConfigFileUsed returns the used configFile.

func (*ConfigParser) EnhancedExactUnmarshal Uses

func (c *ConfigParser) EnhancedExactUnmarshal(output interface{}) error

EnhancedExactUnmarshal is intended to unmarshal a config file into a structure producing error when extraneous variables are introduced and supporting the time.Duration type

func (*ConfigParser) ReadConfig Uses

func (c *ConfigParser) ReadConfig(in io.Reader) error

ReadConfig parses the buffer and initializes the config.

func (*ConfigParser) ReadInConfig Uses

func (c *ConfigParser) ReadInConfig() error

ReadInConfig reads and unmarshals the config file.

func (*ConfigParser) SetConfigName Uses

func (c *ConfigParser) SetConfigName(in string)

SetConfigName provides the configuration file name stem. The upper-cased version of this value also serves as the environment variable override prefix.

Package viperutil imports 18 packages (graph) and is imported by 64 packages. Updated 2020-07-14. Refresh now. Tools for package owners.