Skip to main content
Question

Using variables to select the production or staging redis environment?

  • March 11, 2025
  • 4 replies
  • 40 views

: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`?

4 replies

Jon Rust
Forum|alt.badge.img
  • Employee
  • March 11, 2025

the redis URL field is an expressionyou reference the global vars there``redis://${C.env.CRIBL_GIT_BRANCH == "master" ? "production-redis" : "non-prod-redis"}:6379``


Jon Rust
Forum|alt.badge.img
  • Employee
  • March 11, 2025

possibly easier to understand method:2 redis functions with filters that use the git branch to fire or noteg, redis function one has a filter `C.env.CRIBL_GIT_BRANCH == "master"` and inside references the production-redis url


  • Author
  • Employee
  • March 11, 2025

I liked 2nd approach because my redis credentials are different in production and staging redis


  • Author
  • Employee
  • March 11, 2025

Thank you Jon.