From c62070114052a92aa6216f10e47aea598182e0ad Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Mon, 8 Jan 2024 16:04:46 -0800 Subject: [PATCH] fix: support specifying username/password for redis holding manifests in argocd-server (#16786) Signed-off-by: Alexander Matyushentsev Signed-off-by: penglongli --- util/cache/cache.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/cache/cache.go b/util/cache/cache.go index 9ac058756f4ca..d34fba5d38f7b 100644 --- a/util/cache/cache.go +++ b/util/cache/cache.go @@ -199,6 +199,14 @@ func AddCacheFlagsToCmd(cmd *cobra.Command, opts ...Options) func() (*Cache, err } password := os.Getenv(envRedisPassword) username := os.Getenv(envRedisUsername) + if opt.FlagPrefix != "" { + if val := os.Getenv(opt.getEnvPrefix() + envRedisUsername); val != "" { + username = val + } + if val := os.Getenv(opt.getEnvPrefix() + envRedisPassword); val != "" { + password = val + } + } maxRetries := env.ParseNumFromEnv(envRedisRetryCount, defaultRedisRetryCount, 0, math.MaxInt32) compression, err := CompressionTypeFromString(compressionStr) if err != nil {