mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-30 08:06:40 +02:00
add tls option for sync etcd plugin (#2440)
This commit is contained in:
parent
69b4b5d1c6
commit
4154ed6a80
@ -165,6 +165,7 @@ func NewSync(opts ...sync.Option) sync.Sync {
|
||||
// TODO: parse addresses
|
||||
c, err := clientv3.New(clientv3.Config{
|
||||
Endpoints: endpoints,
|
||||
TLS: options.TLSConfig,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -31,3 +32,10 @@ func LockWait(t time.Duration) LockOption {
|
||||
o.Wait = t
|
||||
}
|
||||
}
|
||||
|
||||
// WithTLS sets the TLS config
|
||||
func WithTLS(t *tls.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.TLSConfig = t
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
@ -37,6 +38,7 @@ type Leader interface {
|
||||
type Options struct {
|
||||
Nodes []string
|
||||
Prefix string
|
||||
TLSConfig *tls.Config
|
||||
}
|
||||
|
||||
type Option func(o *Options)
|
||||
|
Loading…
Reference in New Issue
Block a user