micro/config/config.go

39 lines
804 B
Go
Raw Normal View History

2019-05-31 01:11:13 +03:00
// Package config is an interface for dynamic configuration.
package config
import (
"context"
"errors"
)
2019-05-31 01:11:13 +03:00
var (
// DefaultConfig default config
DefaultConfig Config = NewConfig()
2019-05-31 01:11:13 +03:00
)
var (
// ErrWatcherStopped is returned when source watcher has been stopped
ErrWatcherStopped = errors.New("watcher stopped")
)
2019-05-31 01:11:13 +03:00
// Config is an interface abstraction for dynamic configuration
type Config interface {
// Init the config
Init(opts ...Option) error
2020-03-31 19:13:21 +03:00
// Options in the config
Options() Options
// Load config from sources
Load(context.Context) error
// Save config to sources
Save(context.Context) error
2019-05-31 01:11:13 +03:00
// Watch a value for changes
// Watch(interface{}) (Watcher, error)
String() string
2019-05-31 01:11:13 +03:00
}
// Watcher is the config watcher
//type Watcher interface {
// Next() (, error)
// Stop() error
//}