config: Index | Files | Directories

package config

import ""


Package Files

errors.go helpers.go info.go loader.go

type ErrFailedToLoad Uses

type ErrFailedToLoad struct {
    Reason error

ErrFailedToLoad is returned at any point that load process fails.

func (*ErrFailedToLoad) Error Uses

func (t *ErrFailedToLoad) Error() string

type ErrMissingExtDot Uses

type ErrMissingExtDot struct {
    Ext string

ErrMissingExtDot is returned when the extension is missing the dot prefix.

func (*ErrMissingExtDot) Error Uses

func (t *ErrMissingExtDot) Error() string

type ErrNilParser Uses

type ErrNilParser struct {

ErrNilParser is returned when a register is called with parsers.Parser(nil).

func (*ErrNilParser) Error Uses

func (*ErrNilParser) Error() string

type ErrParserConflict Uses

type ErrParserConflict struct {
    Ext string

ErrParserConflict is returned when a parser is trying to register an extension that is already registered.

func (*ErrParserConflict) Error Uses

func (t *ErrParserConflict) Error() string

type Info Uses

type Info struct {
    ConfigFolder string
    LoadedFiles  []string

Info contains some basic information about what was loaded

type Loader Uses

type Loader interface {
    // RegisterParser add a new parser to N extensions.
    // It will fail if: 1. the parser is `nil`; 2. any of its supported
    // extensions is already registered.
    RegisterParser(parsers.Parser) error
    // SupportedExtensions returns a list of registered extensions.
    SupportedExtensions() []string
    // Load find and loads files into the given data type.
    Load(v interface{}) (*Info, error)
    // SetEnvironmentVariableName changes the default `CONFIG_DIR` variable name.
    // Passing an empty name will disable it
    SetEnvironmentVariableName(name string)

Loader registers parsers and loads files into a given data type.

func NewLoader Uses

func NewLoader() Loader

NewLoader returns a new Loader instance



Package config imports 7 packages (graph). Updated 2020-01-20. Refresh now. Tools for package owners.