TomlConfiguration

package module
v0.0.0-...-85b8114 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: MIT Imports: 8 Imported by: 0

README

TomlConfiguration

A simple configuration with Toml File. supports default tag.

Install

go get github.com/Yprolic/TomlConfiguration

Usage and Examples

Lets define and struct that defines our configuration

type Server struct {
	Name    string 
	Port    int    `default:"6060"`
	Enabled bool
	Users   []string
}

Load the configuration into multiconfig:

m := TOMLLoader{Path: "conf/conf.toml"}
serverConf := &Server{}
err := m.Load(s)

serverConf.Port // by default 6060
serverConf.Name // "prolic"

License

The MIT License (MIT) - see LICENSE for more details

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSourceNotSet = errors.New("config path or reader is not set")
	ErrFileNotFound = errors.New("config file not found")
)

Functions

This section is empty.

Types

type TOMLLoader

type TOMLLoader struct {
	Path   string
	Reader io.Reader
}

func (*TOMLLoader) Load

func (t *TOMLLoader) Load(s interface{}) error

type TagLoader

type TagLoader struct {
	DefaultTagName string
}

Jump to

Keyboard shortcuts

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