-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat: allow optionally setting a prefix for redis keys (closes #12978) #26169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: allow optionally setting a prefix for redis keys (closes #12978) #26169
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
79cca62 to
b9f1b12
Compare
|
|
||
| const ( | ||
| // envRedisKeyPrefix is an env variable name which stores the prefix for redis keys | ||
| envRedisKeyPrefix = "ARGOCD_REDIS_KEY_PREFIX" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can simply keep it to ARGOCD_REDIS_KEY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR! Updated, please take another look.
b9f1b12 to
7ebfba1
Compare
7610b8b to
f23a4cd
Compare
ppapapetrou76
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we want to use a more sophisticated path, like redis hook
See below
https://github.com/githubzhaoqian/go-redis-prefix/blob/main/prefix.go
Also I disagree with removing the word PREFIX from the env variable
The env variable name should clearly describe what is being used for and by omitting the word PREFIX users might be confused
Signed-off-by: healthy-pod <[email protected]>
f23a4cd to
8ef3067
Compare
I am open to update my code but we already have a code path (
Updated back to |
|
Let's give some time to others to chime in. |
Mangaal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall changes LGTM.
I have added a small suggestion. Feel free to resolve it if it is not needed.
| expiration: expiration, | ||
| cache: rediscache.New(&rediscache.Options{Redis: client}), | ||
| redisCompressionType: compressionType, | ||
| prefix: env.StringFromEnv(envRedisKeyPrefix, ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check for whitespace while retrieving the prefix from env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically redis keys are allowed to have whitespace [1].
[1] https://redis.io/docs/latest/develop/using-commands/keyspace/#content-of-keys
Checklist:
Closes #12978