mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-30 22:33:49 +02:00
add tls option for sync etcd plugin (#2440)
This commit is contained in:
@ -165,6 +165,7 @@ func NewSync(opts ...sync.Option) sync.Sync {
|
|||||||
// TODO: parse addresses
|
// TODO: parse addresses
|
||||||
c, err := clientv3.New(clientv3.Config{
|
c, err := clientv3.New(clientv3.Config{
|
||||||
Endpoints: endpoints,
|
Endpoints: endpoints,
|
||||||
|
TLS: options.TLSConfig,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package sync
|
package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,3 +32,10 @@ func LockWait(t time.Duration) LockOption {
|
|||||||
o.Wait = t
|
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
|
package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -37,6 +38,7 @@ type Leader interface {
|
|||||||
type Options struct {
|
type Options struct {
|
||||||
Nodes []string
|
Nodes []string
|
||||||
Prefix string
|
Prefix string
|
||||||
|
TLSConfig *tls.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
type Option func(o *Options)
|
type Option func(o *Options)
|
||||||
|
Reference in New Issue
Block a user