config: minor changes to split config and watcher files

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-08-04 16:02:14 +03:00
parent 2f287b4b80
commit 82d53555e3
4 changed files with 164 additions and 29 deletions

View File

@@ -179,6 +179,22 @@ func (c *vaultConfig) Name() string {
return c.opts.Name
}
func (c *vaultConfig) Watch(ctx context.Context, opts ...config.WatchOption) (config.Watcher, error) {
w := &vaultWatcher{
cli: c.cli,
path: c.path,
opts: c.opts,
wopts: config.NewWatchOptions(opts...),
done: make(chan struct{}),
vchan: make(chan map[string]interface{}),
echan: make(chan error),
}
go w.run()
return w, nil
}
func NewConfig(opts ...config.Option) config.Config {
options := config.NewOptions(opts...)
if len(options.StructTag) == 0 {