peer TLS updates

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2019-10-08 02:22:15 -04:00
parent 6edfb4d93f
commit 1e9e515e65
No known key found for this signature in database
GPG key ID: A519480096146526

View file

@ -28,7 +28,6 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/sirupsen/logrus"
"github.com/stellarproject/heimdall" "github.com/stellarproject/heimdall"
v1 "github.com/stellarproject/heimdall/api/v1" v1 "github.com/stellarproject/heimdall/api/v1"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -102,10 +101,8 @@ func (c *Client) Close() error {
func DialOptionsFromConfig(cfg *heimdall.Config) ([]grpc.DialOption, error) { func DialOptionsFromConfig(cfg *heimdall.Config) ([]grpc.DialOption, error) {
opts := []grpc.DialOption{} opts := []grpc.DialOption{}
if cfg.TLSClientCertificate != "" { if cfg.TLSClientCertificate != "" {
logrus.WithField("cert", cfg.TLSClientCertificate).Debug("configuring TLS cert")
var creds credentials.TransportCredentials var creds credentials.TransportCredentials
if cfg.TLSClientKey != "" { if cfg.TLSClientKey != "" {
logrus.WithField("key", cfg.TLSClientKey).Debug("configuring TLS key")
cert, err := tls.LoadX509KeyPair(cfg.TLSClientCertificate, cfg.TLSClientKey) cert, err := tls.LoadX509KeyPair(cfg.TLSClientCertificate, cfg.TLSClientKey)
if err != nil { if err != nil {
return nil, err return nil, err