Quantcast
Channel: How to set up a database connection from environment in Rocket? - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by SS_Rebelious for How to set up a database connection from...

After a lot of experiments (as there is no specific instructions for the database and I expected something that looked more like a standard approach: ENV_PARAM=conn_string, i.e. in Diesel) I finally...

View Article


Answer by Stargateur for How to set up a database connection from environment...

I would like to set username, password and a database name from the environment. Didn't find relevant example for Rocket.Front page of the docRocket and Rocket libraries are configured via the...

View Article


How to set up a database connection from environment in Rocket?

I have following working database connection setup for my Rocket app:main.rs:#[database("my_db")]pub struct DbConn(diesel::PgConnection);Rocket.toml:[global.databases]my_db = { url =...

View Article

Answer by BergerBytes for How to set up a database connection from...

The accepted answer works, but if you wanted to avoid needing a special formatted environment variable for rocket, you can also update the figment prior to starting rocket.For example:#[launch]async fn...

View Article
Browsing latest articles
Browse All 4 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>