Documentation ¶
Overview ¶
Package copperhead provides a configuration loader that can load configuration from environment, files, or byte slices.
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 encapsulates configuration loading.
func (*Config) Data ¶
func (c *Config) Data(data []byte, unm Unmarshaler) error
Data reads the provided configuration data.
func (*Config) Environment ¶
Environment populates our configuration with environment variables.
type FileMode ¶
type FileMode string
FileMode controls file loading behaviour.
const ( FileRequired FileMode = "required" FileOptional = "optional" )
The file loading modes
type Option ¶
Option configures our... inception!
func WithConfigurationData ¶
func WithConfigurationData(data []byte, unm Unmarshaler) Option
WithConfigurationData reads the provided configuration data.
func WithConfigurationFile ¶
func WithConfigurationFile(filename string, mode FileMode, unm Unmarshaler) Option
WithConfigurationFile reads configuration from a file.
func WithEnvironment ¶
WithEnvironment bootstraps our configuration with environment variables.
type Unmarshaler ¶
Unmarshaler is something that can unmarshal a configuration.
type UnmarshalerFunc ¶
UnmarshalerFunc is an unmarshal function
func (UnmarshalerFunc) Unmarshal ¶
func (uf UnmarshalerFunc) Unmarshal( data []byte, v interface{}, ) error
Unmarshal the config data.