WithKey is a two-in-one coreOption. It uses the remote key on etcd as the source of configuration, and watches the change of that key for hot reloading.
(cfg clientv3.Config, key string, codec contract.Codec)
| 31 | // WithKey is a two-in-one coreOption. It uses the remote key on etcd as the |
| 32 | // source of configuration, and watches the change of that key for hot reloading. |
| 33 | func WithKey(cfg clientv3.Config, key string, codec contract.Codec) (core.CoreOption, core.CoreOption) { |
| 34 | r := Provider(cfg, key) |
| 35 | return core.WithConfigStack(r, config.CodecParser{Codec: codec}), core.WithConfigWatcher(r) |
| 36 | } |
| 37 | |
| 38 | // ReadBytes reads the contents of a key from etcd and returns the bytes. |
| 39 | func (r *ETCD) ReadBytes() ([]byte, error) { |