configloader

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package configloader provides YAML-based configuration files, with automatic environment variable overriding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader interface {
	//Loads a YAML formatted configuration from path into data.
	Load(data interface{}, path string) error
	// SetValue sets a value at path key, as long as it can convert value to
	// the correct type for that key. Otherwise it returns an error.
	SetValue(target interface{}, key, value string) error
	// SetValidValue is similar to SetValue except is also returns an error
	// if the resulting target is not valid. (If target does not implement
	// Validator then it is assumed to be valid.)
	SetValidValue(target interface{}, key, value string) error
	// GetValue returns the value of key in target, or nil and a non-nil
	// error if that key is not found.
	GetValue(target interface{}, key string) (interface{}, error)
}

ConfigLoader loads configuration.

func New

New returns a new ConfigLoader.

type DefaultFiller

type DefaultFiller interface {
	FillDefaults() error
}

DefaultFiller can fill defaults for a config

type Validator added in v0.0.3

type Validator interface {
	Validate() error
}

A Validator validates

Jump to

Keyboard shortcuts

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