Commit bd1465b1 authored by Theron Voran's avatar Theron Voran
Browse files

use TransportDialer iface from consul-template

parent a52d06bf
Showing with 12 additions and 17 deletions
+12 -17
......@@ -683,7 +683,7 @@ func (c *AgentCommand) Run(args []string) int {
ErrorLog: cacheLogger.StandardLogger(nil),
}
go server.Serve(inProcListener)
config.Cache.CustomDialer = inProcListener
config.Cache.InProcDialer = inProcListener
var listeners []net.Listener
for i, lnConfig := range config.Listeners {
......
......@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"io/ioutil"
"net"
"os"
"strings"
"time"
......@@ -66,13 +65,13 @@ type Vault struct {
// Cache contains any configuration needed for Cache mode
type Cache struct {
UseAutoAuthTokenRaw interface{} `hcl:"use_auto_auth_token"`
UseAutoAuthToken bool `hcl:"-"`
ForceAutoAuthToken bool `hcl:"-"`
EnforceConsistency string `hcl:"enforce_consistency"`
WhenInconsistent string `hcl:"when_inconsistent"`
Persist *Persist `hcl:"persist"`
CustomDialer VaultDialer `hcl:"-"`
UseAutoAuthTokenRaw interface{} `hcl:"use_auto_auth_token"`
UseAutoAuthToken bool `hcl:"-"`
ForceAutoAuthToken bool `hcl:"-"`
EnforceConsistency string `hcl:"enforce_consistency"`
WhenInconsistent string `hcl:"when_inconsistent"`
Persist *Persist `hcl:"persist"`
InProcDialer ctconfig.TransportDialer `hcl:"-"`
}
// Persist contains configuration needed for persistent caching
......@@ -126,12 +125,6 @@ type TemplateConfig struct {
StaticSecretRenderInt time.Duration `hcl:"-"`
}
// VaultDialer is an interface that allows passing a custom dialer to the Vault
// client transport config
type VaultDialer interface {
Dial(network, address string) (net.Conn, error)
}
func NewConfig() *Config {
return &Config{
SharedConfig: new(configutil.SharedConfig),
......
......@@ -285,7 +285,7 @@ func newRunnerConfig(sc *ServerConfig, templates ctconfig.TemplateConfigs) (*ctc
attempts = ctconfig.DefaultRetryAttempts
}
conf.Vault.Transport.CustomDialer = sc.AgentConfig.Cache.CustomDialer
conf.Vault.Transport.CustomDialer = sc.AgentConfig.Cache.InProcDialer
// TODO(tvoran): do we still need all these if we're just doing it over pipe?
// scheme := "unix://"
// if sc.AgentConfig.Listeners[0].Type == "tcp" {
......
......@@ -195,4 +195,4 @@ require (
mvdan.cc/gofumpt v0.1.1
)
replace github.com/hashicorp/consul-template => ./consul-template
replace github.com/hashicorp/consul-template => github.com/tvoran/consul-template v0.27.2-0.20211001014530-1148ff14aa78
......@@ -1224,6 +1224,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/tvoran/consul-template v0.27.2-0.20211001014530-1148ff14aa78 h1:dEx3WvHwWB19NzaLwU/HviLtkFa2dwlbf3hRLZeHKvE=
github.com/tvoran/consul-template v0.27.2-0.20211001014530-1148ff14aa78/go.mod h1:cAi5bOqno7Ao5sFHu7O80wMOPnqcF5ADrTApWU4Lqx4=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment