parent
048f1284e4
commit
a090caf2c3
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/base64"
|
||||
"errors"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -121,6 +122,22 @@ func newEtcdBackend(conf map[string]string) (Backend, error) {
|
|||
Transport: cTransport,
|
||||
}
|
||||
|
||||
// Set credentials.
|
||||
username := os.Getenv("ETCD_USERNAME")
|
||||
if username == "" {
|
||||
username, _ = conf["username"]
|
||||
}
|
||||
|
||||
password := os.Getenv("ETCD_PASSWORD")
|
||||
if password == "" {
|
||||
password, _ = conf["password"]
|
||||
}
|
||||
|
||||
if username != "" && password != "" {
|
||||
cfg.Username = username
|
||||
cfg.Password = password
|
||||
}
|
||||
|
||||
c, err := client.New(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue