-
Hi! Apologies for any undertones/rantiness in this question - I hope I can be forgiven the frustration of banging my head against this wall for ~6 hours the last 18. What I wantA rocket-based rust application that on startup reads environment variables containing NB: If I have to manually merge these together with a pre-flight script, into a What I have tried
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Oh no. The key is It would be great if we could get a "hey, we found this configuration which is close to what we expected but isn't actually; did you mean that?" |
Beta Was this translation helpful? Give feedback.
-
Your answer and suggestion is much appreciated @SergioBenitez, but it's not an answer to what I thought I'd worded the discussion for =/ But no, it doesn't help me with the request:
|
Beta Was this translation helpful? Give feedback.
-
Solution to my question: As of version Aka (for a given rust code shown below): # contents of some shellscript to start the compiled rocket binary/program
dbName="${DB_NAME}"
dbAddr="${DB_HOST}"
dbPort="${DB_PORT}"
dbUser="${DB_USER}"
dbPassword="${DB_PASSWORD}"
ROCKET_DATABASES="APP_DATABASE={url='postgres://${dbUser}:${dbPassword}@${dbAddr}/${dbName}'}" target/(debug|release)/my-app And Rust code: #[derive(Database)]
#[database("APP_DATABASE")]
struct Db(sqlx::PgPool); https://api.rocket.rs/v0.5-rc/rocket_db_pools/index.html#configuration (mentioned in my opening post) does document this. I just could not get it to work at first due to my docker daemon issue mentioned here. |
Beta Was this translation helpful? Give feedback.
Solution to my question:
As of version
0.5.0-rc.3
, you must make a script that parses/reads/incorporates values from other files/env-vars into aRocket.toml
file orROCKET_DATABASES
env-var.There is no other choice. (read: No mapping as inquired exists).
Aka (for a given rust code shown below):
And Rust code:
ht…