Documentation
¶
Overview ¶
Package config parsed toml files in specific order to generate a validated struct
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.1.0
type Config struct {
ErrorsValidation *validator.ValidationErrors
}
func New ¶ added in v1.0.1
func New(options *NewOptions) (*Config, error)
New read configurations with priority, the later overrides the previous
type LoadConfigs ¶ added in v1.1.0
type LoadConfigs func(options *LoadConfigsOptions) ([][]byte, error)
Allow user to load configs, user has to return a []byte which has been through json.Marshal into []byte The payload is in the end going to be json.Unmarshaled
type LoadConfigsOptions ¶ added in v1.1.0
type LoadConfigsOptions struct {
FilesLoaded []string
ConfigJSONMergedBytes []byte
RunEnv string
TOML *LoadConfigsOptionsTOML
}
type LoadConfigsOptionsTOML ¶ added in v1.1.0
type LoadConfigsOptionsTOML struct {
FileToJSON func(string) ([]byte, error)
StringToJSON func(string) ([]byte, error)
BytesToJSON func([]byte) ([]byte, error)
ReaderToJSON func(io.Reader) ([]byte, error)
FileReaderToJSON func(file fs.File, closeFile bool) ([]byte, error)
FileReaderCallbackToJSON func(getFileCallback func() (fs.File, error)) ([]byte, error)
}
type NewOptions ¶ added in v1.0.1
type NewOptions struct {
OnConfigBeforeValidation OnConfigBeforeValidation
LoadConfigs LoadConfigs
EnvKeyRunEnv string
PathConfigs string
ConfigUnmarshal interface{}
}
type OnConfigBeforeValidation ¶ added in v1.1.0
type OnConfigBeforeValidation func(options *OnConfigBeforeValidationOptions) error
Allows user to have a shot on the config before it validats
type OnConfigBeforeValidationOptions ¶ added in v1.1.0
type OnConfigBeforeValidationOptions struct {
ConfigUnmarshal interface{}
}
Directories
¶
| Path | Synopsis |
|---|---|
|
pkg
|
|
|
environment
Package env environment handle environment variables
|
Package env environment handle environment variables |
|
file
Package file file related operations
|
Package file file related operations |
|
reflection
Package reflection reflect stuff
|
Package reflection reflect stuff |
|
walker-type
Package walkertype walks types
|
Package walkertype walks types |
Click to show internal directories.
Click to hide internal directories.