Documentation ¶
Overview ¶
Package goconfig provides a simple method for configuring applications.
This package is a work in progress and makes no API stability promises.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the main configuration struct. It uses Viper as configuration backend.
func (*Config) AddValidator ¶
AddValidator add custom validator to Config.
func (*Config) Data ¶
func (c *Config) Data(section string) Configurable
Data returns a Configurable data section.
func (*Config) LoadFromFile ¶
LoadFromFile configuration data.
func (*Config) LoadIfFile ¶
LoadIfFile try to load from path if not empty.
type Configurable ¶
type Configurable interface { //SetPFlags sets posix flags with the prefix and short options SetPFlags(short bool, prefix string) //BindViper must bind to viper instance pflags with the prefix BindViper(v *viper.Viper, prefix string) //BindViper must load values from viper instance FromViper(v *viper.Viper, prefix string) //Empty returns true if configuration is empty Empty() bool //Validate returns error if invalid value Validate() error //Dump returns string Dump() string }
Configurable is the interface for configuration data.
Click to show internal directories.
Click to hide internal directories.