From 5a3f71421549c19121884d23a1051691c334fe09 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:05:51 -0400 Subject: [PATCH] backport of commit 8fe7076c02ac08e4e2e803243c2f9e4ae323ca10 (#20939) Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com> --- command/agent.go | 2 +- command/agent/config/config.go | 2 +- .../agent/config/test-fixtures/config-env-templates-complex.hcl | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/command/agent.go b/command/agent.go index d3737be9a..11942ce53 100644 --- a/command/agent.go +++ b/command/agent.go @@ -517,7 +517,7 @@ func (c *AgentCommand) Run(args []string) int { var listeners []net.Listener // If there are templates, add an in-process listener - if len(config.Templates) > 0 { + if len(config.Templates) > 0 || len(config.EnvTemplates) > 0 { config.Listeners = append(config.Listeners, &configutil.Listener{Type: listenerutil.BufConnType}) } diff --git a/command/agent/config/config.go b/command/agent/config/config.go index 05774091b..eea108b9f 100644 --- a/command/agent/config/config.go +++ b/command/agent/config/config.go @@ -311,7 +311,7 @@ func (c *Config) ValidateConfig() error { } if c.Cache != nil { - if len(c.Listeners) < 1 && len(c.Templates) < 1 { + if len(c.Listeners) < 1 && len(c.Templates) < 1 && len(c.EnvTemplates) < 1 { return fmt.Errorf("enabling the cache requires at least 1 template or 1 listener to be defined") } diff --git a/command/agent/config/test-fixtures/config-env-templates-complex.hcl b/command/agent/config/test-fixtures/config-env-templates-complex.hcl index 67f0152a1..639b1288f 100644 --- a/command/agent/config/test-fixtures/config-env-templates-complex.hcl +++ b/command/agent/config/test-fixtures/config-env-templates-complex.hcl @@ -9,6 +9,8 @@ auto_auth { } } +cache {} + template_config { static_secret_render_interval = "5m" exit_on_retry_failure = true