Skip to content

Commit

Permalink
TLS Config option added
Browse files Browse the repository at this point in the history
  • Loading branch information
erkanzsy committed Jul 3, 2023
1 parent 2ce3ae1 commit d95d8e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion etcd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ type Config struct {
Username string
// Password is a password for authentication.
Password string
// TLS holds the client secure credentials, if any.
TLS *tls.Config
}
```

### Default Config
```go
var ConfigDefault = Config{
Endpoints: []string{"localhost:2379"},
DialTimeout: 1 * time.Millisecond,
DialTimeout: 2 * time.Second,
Username: "",
Password: "",
TLS: nil,
}
```
4 changes: 4 additions & 0 deletions etcd/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package etcd

import (
"crypto/tls"
"time"
)

Expand All @@ -14,6 +15,8 @@ type Config struct {
Username string
// Password is a password for authentication.
Password string
// TLS holds the client secure credentials, if any.
TLS *tls.Config
}

// ConfigDefault is the default config
Expand All @@ -22,6 +25,7 @@ var ConfigDefault = Config{
DialTimeout: 2 * time.Second,
Username: "",
Password: "",
TLS: nil,
}

// Helper function to set default values
Expand Down
1 change: 1 addition & 0 deletions etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func New(config ...Config) *Storage {
DialTimeout: cfg.DialTimeout,
Username: cfg.Username,
Password: cfg.Password,
TLS: cfg.TLS,
})
if err != nil {
panic(err)
Expand Down

0 comments on commit d95d8e9

Please sign in to comment.