1
0
Fork 0
mirror of https://github.com/Luzifer/vault-openvpn.git synced 2024-11-10 01:00:08 +00:00

Simplify TLS handling

This commit is contained in:
Miguel Eduardo Gil Biraud 2016-08-25 17:13:40 +02:00
parent 542310fd7a
commit 9bbffb9896

View file

@ -7,7 +7,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http"
"os" "os"
"strings" "strings"
"text/template" "text/template"
@ -15,7 +14,6 @@ import (
"github.com/Luzifer/go_helpers/str" "github.com/Luzifer/go_helpers/str"
"github.com/Luzifer/rconfig" "github.com/Luzifer/rconfig"
"github.com/hashicorp/go-rootcerts"
"github.com/hashicorp/vault/api" "github.com/hashicorp/vault/api"
homedir "github.com/mitchellh/go-homedir" homedir "github.com/mitchellh/go-homedir"
) )
@ -101,14 +99,9 @@ func main() {
var err error var err error
clientConfig := api.DefaultConfig() clientConfig := api.DefaultConfig()
clientConfig.ReadEnvironment()
clientConfig.Address = cfg.VaultAddress clientConfig.Address = cfg.VaultAddress
tlsConfig := clientConfig.HttpClient.Transport.(*http.Transport).TLSClientConfig
err = rootcerts.ConfigureTLS(tlsConfig, nil)
if err != nil {
log.Fatalf("Could not configure TLS: %s", err)
}
client, err = api.NewClient(clientConfig) client, err = api.NewClient(clientConfig)
if err != nil { if err != nil {
log.Fatalf("Could not create Vault client: %s", err) log.Fatalf("Could not create Vault client: %s", err)