mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-30 08:06:40 +02:00
33 lines
465 B
Go
33 lines
465 B
Go
package vault
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/hashicorp/vault/api"
|
|
"go-micro.dev/v4/config/source"
|
|
)
|
|
|
|
type watcher struct {
|
|
c *api.Client
|
|
exit chan bool
|
|
}
|
|
|
|
func newWatcher(c *api.Client) *watcher {
|
|
return &watcher{
|
|
c: c,
|
|
exit: make(chan bool),
|
|
}
|
|
}
|
|
|
|
func (w *watcher) Next() (*source.ChangeSet, error) {
|
|
<-w.exit
|
|
return nil, errors.New("url watcher stopped")
|
|
}
|
|
|
|
func (w *watcher) Stop() error {
|
|
select {
|
|
case <-w.exit:
|
|
default:
|
|
}
|
|
return nil
|
|
}
|