add backend
parent
4132d48e71
commit
626d43ede8
|
@ -20,11 +20,12 @@ type etcdBackend struct {
|
||||||
client *clientv3.Client
|
client *clientv3.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(ctx context.Context, cnf *config.Config) (iface.Backend, error) {
|
func New(ctx context.Context, conf *config.Config) (iface.Backend, error) {
|
||||||
etcdConf := clientv3.Config{
|
etcdConf := clientv3.Config{
|
||||||
Endpoints: []string{cnf.ResultBackend},
|
Endpoints: []string{conf.ResultBackend},
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
DialTimeout: time.Second * 5,
|
DialTimeout: time.Second * 5,
|
||||||
|
TLS: conf.TLSConfig,
|
||||||
}
|
}
|
||||||
client, err := clientv3.New(etcdConf)
|
client, err := clientv3.New(etcdConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,10 +33,10 @@ func New(ctx context.Context, cnf *config.Config) (iface.Backend, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
backend := etcdBackend{
|
backend := etcdBackend{
|
||||||
Backend: common.NewBackend(cnf),
|
Backend: common.NewBackend(conf),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
client: client,
|
client: client,
|
||||||
conf: cnf,
|
conf: conf,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &backend, nil
|
return &backend, nil
|
||||||
|
|
|
@ -59,9 +59,10 @@ type etcdBroker struct {
|
||||||
// New ..
|
// New ..
|
||||||
func New(ctx context.Context, conf *config.Config) (iface.Broker, error) {
|
func New(ctx context.Context, conf *config.Config) (iface.Broker, error) {
|
||||||
etcdConf := clientv3.Config{
|
etcdConf := clientv3.Config{
|
||||||
Endpoints: []string{conf.Broker},
|
Endpoints: []string{conf.Lock},
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
DialTimeout: time.Second * 5,
|
DialTimeout: time.Second * 5,
|
||||||
|
TLS: conf.TLSConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := clientv3.New(etcdConf)
|
client, err := clientv3.New(etcdConf)
|
||||||
|
|
|
@ -31,6 +31,7 @@ func New(ctx context.Context, conf *config.Config, retries int) (iface.Lock, err
|
||||||
Endpoints: []string{conf.Lock},
|
Endpoints: []string{conf.Lock},
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
DialTimeout: time.Second * 5,
|
DialTimeout: time.Second * 5,
|
||||||
|
TLS: conf.TLSConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := clientv3.New(etcdConf)
|
client, err := clientv3.New(etcdConf)
|
||||||
|
|
Loading…
Reference in New Issue