-
Notifications
You must be signed in to change notification settings - Fork 54
/
konfig.go
45 lines (45 loc) · 1.18 KB
/
konfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Package konfig provides a composable, observable and performant
// config handling for Go.
// Written for larger distributed systems where you may have plenty of
// configuration sources - it allows you to compose configurations from
// multiple sources with reload hooks making it simple to build apps that live
// in a highly dynamic environment.
//
// Konfig is built around 4 small interfaces: Loader, Watcher, Parser, Closer
//
// Get started:
// var configFiles = []klfile.File{
// {
// Path: "./config.json",
// Parser: kpjson.Parser,
// },
// }
//
// func init() {
// konfig.Init(konfig.DefaultConfig())
// }
//
// func main() {
// // load from json file with a file wacher
// konfig.RegisterLoaderWatcher(
// klfile.New(&klfile.Config{
// Files: configFiles,
// Watch: true,
// }),
// // optionally you can pass config hooks to run when a file is changed
// func(c konfig.Store) error {
// return nil
// },
// )
//
// // Load and start watching
// if err := konfig.LoadWatch(); err != nil {
// log.Fatal(err)
// }
//
// // retrieve value from config file
// konfig.Bool("debug")
// }
//
//
package konfig