Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Oct 25, 2019
1 parent 6bda1ed commit 0c8f648
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
24 changes: 1 addition & 23 deletions command/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/hashicorp/vault/command/agent/auth/jwt"
"github.com/hashicorp/vault/command/agent/auth/kubernetes"
"github.com/hashicorp/vault/command/agent/cache"
"github.com/hashicorp/vault/command/agent/config"
agentConfig "github.com/hashicorp/vault/command/agent/config"
"github.com/hashicorp/vault/command/agent/sink"
"github.com/hashicorp/vault/command/agent/sink/file"
Expand Down Expand Up @@ -523,11 +522,8 @@ func (c *AgentCommand) Run(args []string) int {
})
ssDoneCh = ss.DoneCh

// create an independent vault configuration for Consul Template to use
// vaultConfig := c.setupTemplateConfig()
ts := template.NewServer(&template.ServerConfig{
Logger: c.logger.Named("template.server"),
// VaultConf: vaultConfig,
Logger: c.logger.Named("template.server"),
VaultConf: config.Vault,
Namespace: namespace,
ExitAfterAuth: config.ExitAfterAuth,
Expand Down Expand Up @@ -687,21 +683,3 @@ func (c *AgentCommand) removePidFile(pidPath string) error {
}
return os.Remove(pidPath)
}

// setupTemplateConfig creates a config.Vault struct for use by Consul Template.
// Consul Template does not currently allow us to pass in a configured API
// client, unlike the AuthHandler and SinkServer that reuse the client created
// in this Run() method. Here we build a config.Vault struct for use by the
// Template Server that matches the configuration used to create the client
// (c.client), but in a struct of type config.Vault so that Consul Template can
// create it's own api client internally.
func (c *AgentCommand) setupTemplateConfig() *config.Vault {
return &config.Vault{
Address: c.flagAddress,
CACert: c.flagCACert,
CAPath: c.flagCAPath,
ClientCert: c.flagClientCert,
ClientKey: c.flagClientKey,
TLSSkipVerify: c.flagTLSSkipVerify,
}
}
3 changes: 0 additions & 3 deletions command/agent/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type Server struct {
// Templates holds the parsed Consul Templates
Templates []*ctconfig.TemplateConfig

// TODO: remove donech?
DoneCh chan struct{}
logger hclog.Logger
exitAfterAuth bool
Expand Down Expand Up @@ -110,8 +109,6 @@ func (ts *Server) Run(ctx context.Context, incoming chan string, templates []*ct
},
}
runnerConfig = runnerConfig.Merge(&ctv)
// TODO: remove?
// runnerConfig.Finalize()
var runnerErr error
ts.runner, runnerErr = manager.NewRunner(runnerConfig, false)
if runnerErr != nil {
Expand Down

0 comments on commit 0c8f648

Please sign in to comment.