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 Duration ¶ added in v1.2.0
Duration is an TextUnmarshaler-aware Duration
func (*Duration) UnmarshalText ¶ added in v1.2.0
UnmarshalText implements encoding.TextUnmarshaler.
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 Time ¶ added in v1.2.0
Time is an TextUnmarshaler-aware Time
func (*Time) UnmarshalText ¶ added in v1.2.0
UnmarshalText implements encoding.TextUnmarshaler.
type URL ¶ added in v1.1.0
URL is an TextUnmarshaler-aware URL
func (*URL) UnmarshalText ¶ added in v1.1.0
UnmarshalText implements encoding.TextUnmarshaler.
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.