Documentation ¶
Index ¶
- func LocalFolderLocator(filename string) (name string, err error)
- func NewFileConfiguration(opts FullOptions) config.Configuration
- func NewPlaceholdersReplacerReader(originalReader func(string) ([]byte, error), props config.Configuration) func(string) ([]byte, error)
- func NoopLocator(name string) (string, error)
- type FullOptions
- type Locator
- type Options
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalFolderLocator ¶
LocalFolderLocator locates files only in current folder
func NewFileConfiguration ¶
func NewFileConfiguration(opts FullOptions) config.Configuration
NewFileConfiguration creates and returns new file-based configuration
func NewPlaceholdersReplacerReader ¶
func NewPlaceholdersReplacerReader(originalReader func(string) ([]byte, error), props config.Configuration) func(string) ([]byte, error)
NewPlaceholdersReplacerReader return reader, that replaces placeholders
func NoopLocator ¶
NoopLocator is locator that does nothing, just returns provided string as response with nil error
Types ¶
type FullOptions ¶
type FullOptions struct { Options // Reader, used to read byte slice (file contents) into // intermediate key-value map ByteToMapReader func([]byte) (map[string]interface{}, error) // Mapper used to write final configuration values ReflectionMapper func(source interface{}, target interface{}) error }
FullOptions holds full information, required to read a file
type Locator ¶
Locator is function, able to found file in different locations
func NewCommonLocationsLocator ¶
NewCommonLocationsLocator return a locator, that will search for file in current folder, home folder and /etc/. Subfolder may be configured
type Options ¶
type Options struct { // Configuration file name Filename string // Locator, used to find file Locator Locator // Reader, used to read file contents Reader Reader }
Options holds minimal information, required to read a file
func (Options) WithDefaults ¶
WithDefaults returns copy of options with default values set instead missing ones