mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-03 04:51:12 +02:00
parent
91e2ddd167
commit
ef5bc3e4cb
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -121,6 +122,22 @@ func newEtcdBackend(conf map[string]string) (Backend, error) {
|
|||||||
Transport: cTransport,
|
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)
|
c, err := client.New(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user