Using variables to select the production or staging redis environment?
:question: - I have two branches. `master` is my production and `staging` is my staging/dev environment. I also have two redis servers for production (`production-redis`) and staging (`non-prod-redis`) Cribl. Now in redis function, how can I use `C.env.CRIBL_GIT_BRANCH` variable to specify either `production-redis` OR `non-prod-redis`?
Answers
-
the redis URL field is an expression you reference the global vars there ``redis://${C.env.CRIBL_GIT_BRANCH == "master" ? "production-redis" : "non-prod-redis"}:6379``
0 -
possibly easier to understand method: 2 redis functions with filters that use the git branch to fire or not eg, redis function one has a filter `C.env.CRIBL_GIT_BRANCH == "master"` and inside references the production-redis url
0 -
I liked 2nd approach because my redis credentials are different in production and staging redis
0 -
Thank you Jon.
0