mirror of
https://github.com/Luzifer/vault-openvpn.git
synced 2024-12-25 22:31:20 +00:00
Simplify TLS handling
This commit is contained in:
parent
542310fd7a
commit
9bbffb9896
1 changed files with 1 additions and 8 deletions
9
main.go
9
main.go
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
@ -15,7 +14,6 @@ import (
|
|||
|
||||
"github.com/Luzifer/go_helpers/str"
|
||||
"github.com/Luzifer/rconfig"
|
||||
"github.com/hashicorp/go-rootcerts"
|
||||
"github.com/hashicorp/vault/api"
|
||||
homedir "github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
@ -101,14 +99,9 @@ func main() {
|
|||
var err error
|
||||
|
||||
clientConfig := api.DefaultConfig()
|
||||
clientConfig.ReadEnvironment()
|
||||
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)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not create Vault client: %s", err)
|
||||
|
|
Loading…
Reference in a new issue