How to setup a password for redis inside the Rocket.toml file? #2331
Replies: 1 comment 3 replies
-
I haven't actually used redis with Rocket before, but the idea should not be much more different with other database engines. To put the password in the database URI, you'll have to use the following format:
The problem is you cannot really "append" the password to the URL in the Rocket.toml, it needs the complete URL with the password in it. Instead you have to overwrite the whole value with a new one, containing the password as well. To do that you'll need to set the following env var:
Yes, the name of the Env var has lowercase letters and dots as well, which is kinda strange and some shells don't like it, but this is how it works for now unfortunately. If you only have the password in the MY_REDIS_PASSWORD env var, then you'll have to come up with some Docker magic to concatenate it to the URL and put it into the Rocket specific env var. |
Beta Was this translation helpful? Give feedback.
-
I swear this is the hardest thing to find on the internet.
My Redis instance has a password.
How do i configure this from an environment variable in the
Rocket.toml
file?Here is what i have inside
Rocket.toml
. And it works perfectly if redis has no password.redis_trending_server
here is my redis server given from docker-compose file. This works. But now I have set a redis password.I have also passed this password in an environment variable to Rust ${MY_REDIS_PASSWORD}
Now inside the
Rocket.toml
file how do i firstand then
I cant find a single documentation any where on this -__-
Beta Was this translation helpful? Give feedback.
All reactions