valeriansaliou / bloom

:cherry_blossom: HTTP REST API caching middleware, to be used between load balancers and REST API workers.

Home Page:https://crates.io/crates/bloom-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use environment variables in config

Malanius opened this issue · comments

Hello, I'd like to have the possibility to reference environment variables inside the configuration file. For now, it doesn't seem to work or I didn't figure out how to do that.

For example, I have bloom packed inside a docker container along with the backend and I'd like to reuse the same image on different environments and be able to configure the Redis host as each environment has its own cluster with REDIST_HOST env var.
The rest of the backend configuration is done through environment variables (following the 12fa principles) and it would be great to have the same possibility in bloom as well.

For now, I can work around this by replacing some placeholder value in the config using entry point script, but that doesn't feel as clean and it's quite rare to find something that doesn't support configuration from env vars nowadays 🙂

PS: I might be able to hack on this, but never done something in Rust before so I would need some pointers on how to deal with this.

Hello! Someone has already done a PR for Sonic, another Rust project of mine: valeriansaliou/sonic#148

I'm accepting any PR on this if you're willing to work on it :) Note that I may have refactored the env var reader code in Sonic, so you may look at the env var parsing code from the master branch instead of the original PR I provided here.

Thanks, that will be helpful! I'll take a look at how it's done in sonic and if it is something I could reimplement for bloom.