conf

package
v0.0.0-...-add2d34 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(val interface{}, prefix string, defStr string)

Config registers a configuration value. This must be done before calling Load() Val can be: - func (T, error) - chan T - *T T may be anything supported by https://github.com/go-ini/ini Prefix should be a non-empty string for the table name defStr should contain valid TOML that is used as the default Such as `# Enable my key enable = true ` Note their is no table, and a trailing newline

func Load

func Load(path string)

Load should be called with a path to the config directory It should contain a config.ini and will be created as necesary All Config calls should be done. Path and OpenFile can be called after this

func OpenFile

func OpenFile(name string, val interface{}) error

OpenFile will take a name relative to the config Root as passed to Load and update var accordingly. Val can be: - func (T, error) - chan T - *T T may be: - struct{} - *os.File - string - []byte - interface{} which will be JSON decoded

func OpenFileDefault

func OpenFileDefault(name string, val interface{}, defaul string) error

OpenFileDefault is like OpenFile but will fill the file with the contents of default if it doesn't exists or is empty

func Path

func Path(end string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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