From fd5e146afa4016fe4bf96fe6dfcfd1661d53ad69 Mon Sep 17 00:00:00 2001 From: Zubair Haque Date: Fri, 6 Sep 2024 15:31:43 -0400 Subject: [PATCH] Update bitwardensecrets.go helper function --- pkg/providers/bitwardensecrets/bitwardensecrets.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/providers/bitwardensecrets/bitwardensecrets.go b/pkg/providers/bitwardensecrets/bitwardensecrets.go index f991ec4..f4688ff 100644 --- a/pkg/providers/bitwardensecrets/bitwardensecrets.go +++ b/pkg/providers/bitwardensecrets/bitwardensecrets.go @@ -25,6 +25,17 @@ type provider struct { ProjectID string } +func getConfigOrEnv(cfg api.StaticConfig, key string, envVar string, defaultValue string) string { + value := cfg.String(key) + if value == "" { + value = os.Getenv(envVar) + } + if value == "" { + value = defaultValue + } + return value +} + func New(l *log.Logger, cfg api.StaticConfig) *provider { p := &provider{ log: l,