README
¶
Config 
Config is a pluggable dynamic config package
Most config in applications are statically configured or include complex logic to load from multiple sources. Go Config makes this easy, pluggable and mergeable. You'll never have to deal with config in the same way again.
Features
-
Dynamic Loading - Load configuration from multiple source as and when needed. Go Config manages watching config sources in the background and automatically merges and updates an in memory view.
-
Pluggable Sources - Choose from any number of sources to load and merge config. The backend source is abstracted away into a standard format consumed internally and decoded via encoders. Sources can be env vars, flags, file, etcd, k8s configmap, etc.
-
Mergeable Config - If you specify multiple sources of config, regardless of format, they will be merged and presented in a single view. This massively simplifies priority order loading and changes based on environment.
-
Observe Changes - Optionally watch the config for changes to specific values. Hot reload your app using Go Config's watcher. You don't have to handle ad-hoc hup reloading or whatever else, just keep reading the config and watch for changes if you need to be notified.
-
Sane Defaults - In case config loads badly or is completely wiped away for some unknown reason, you can specify fallback values when accessing any config values directly. This ensures you'll always be reading some sane default in the event of a problem.
Getting Started
For detailed information or architecture, installation and general usage see the docs
Documentation
¶
Overview ¶
Package config is an interface for dynamic configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// Default Config Manager
DefaultConfig, _ = NewConfig()
)
Functions ¶
Types ¶
type Config ¶
type Config interface { // provide the reader.Values interface reader.Values // Init the config Init(opts ...Option) error // Options in the config Options() Options // Stop the config loader/watcher Close() error // Load config sources Load(source ...source.Source) error // Force a source changeset sync Sync() error // Watch a value for changes Watch(path ...string) (Watcher, error) }
Config is an interface abstraction for dynamic configuration
type Option ¶
type Option func(o *Options)
func WithLoader ¶
WithLoader sets the loader for manager config
func WithSource ¶
WithSource appends a source to list of sources
Directories
¶
Path | Synopsis |
---|---|
Package cmd is an interface for parsing the command line
|
Package cmd is an interface for parsing the command line |
Package encoder handles source encoding formats
|
Package encoder handles source encoding formats |
package loader manages loading from multiple sources
|
package loader manages loading from multiple sources |
Package reader parses change sets and provides config values
|
Package reader parses change sets and provides config values |
Package secrets is an interface for encrypting and decrypting secrets
|
Package secrets is an interface for encrypting and decrypting secrets |
box
Package box is an asymmetric implementation of config/secrets using nacl/box
|
Package box is an asymmetric implementation of config/secrets using nacl/box |
secretbox
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification
|
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification |
Package source is the interface for sources
|
Package source is the interface for sources |
file
Package file is a file source.
|
Package file is a file source. |
memory
Package memory is a memory source
|
Package memory is a memory source |