Rust / Rocket environment variables

I am deploying a service which is built on Rust using Rocket and Diesel to connect to a postgres database.
I have created the postgres database and am trying to set the environment variable for the runtime to find.
In the environment I have (example not my actual settings):
name: ROCKET_DATABASES
value: {db={url=“postgres://user:password@render.com/postgres”}}
When my runtime kicked off with:
./build/release/server
(don’t want to run “cargo run --release --bin server” as it rebuilds the whole lot)
it cannot find the environment variable. Which works locally when I export it. Is there something special I need to do to get it to find my ROCKET_DATABASES environment variable?

Thanks.

Looks like it worked third time round. Not sure what the difference was maybe the single quotes I originally had on the value.

Hey,

It’s difficult to guess what happened without having a deeper look at your code/service/error messages you received.

It’s likely that the environment variable was not available to your service at runtime.

Jérémy, Render Support

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.