file

package
v0.0.0-...-6e4230c Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonFolders

func CommonFolders(filename string) []string

CommonFolders returns list of common folder for configuration location including current folder, home folder and etc

func CommonFoldersWithSubfolder

func CommonFoldersWithSubfolder(filename, subfolder string) []string

CommonFoldersWithSubfolder returns list of common folder for configuration location including current folder, home folder and etc

func PlaceholdersReader

func PlaceholdersReader(read func(string) ([]byte, error), configurer cfg.Configurer) func(string) ([]byte, error)

PlaceholdersReader return file reader function, that reads file from filesystem and replaces all placeholders in it using previously loaded configs Ordering matters

Types

type Configurer

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

Configurer is container for file-based configuration

func New

func New(fileNames []string, read func(string) ([]byte, error), build func([]byte) (cfg.Configurer, error)) *Configurer

New creates file-based configuration source

func (*Configurer) Has

func (c *Configurer) Has(key string) bool

Has returns true if configurer has requested field

func (*Configurer) KeyFunc

func (c *Configurer) KeyFunc(key string) func(interface{}) error

KeyFunc return Unmarshaling function for requested key

func (*Configurer) Reload

func (c *Configurer) Reload() error

Reload reloads file container

func (*Configurer) UnmarshalKey

func (c *Configurer) UnmarshalKey(key string, target interface{}) error

UnmarshalKey writes configuration value from string key into interface target

func (*Configurer) Validate

func (c *Configurer) Validate() error

Validate validates container

Jump to

Keyboard shortcuts

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