Railway postgres env is quite different from what I intend to use as per my company styleguide

Hello I noticed that with Railway postgres we have envs like PGHOST PGPORT. Is there a way to change it to something like POSTGRES_HOST and so on. Of course I could just reassign the envs but this won't work for PR builds
10 Replies
Percy
Percy2y ago
Project ID: N/A
Faruq Alli-Balogun
N/A
Percy
Percy2y ago
You might find these helpful: - PR Environment Variables - vapor
⚠️ experimental feature
Faruq Alli-Balogun
Because of that I'm having to do this
Faruq Alli-Balogun
Which is really bad. It does not make my code platform agnostic Any helpers here. it's a huge blocker because I have to remove the implementation above. Thank you
root
root2y ago
Well, postgres generally uses the PG<whatever> variables as a standard, so you should probably use those. However, you can add variables to the Environment Variables tab of your Railway services to fix it. e.g.:
POSTGRES_HOST=${PGHOST}
POSTGRES_PORT=${PGPORT}
POSTGRES_USER=${PGUSER}
POSTGRES_PASSWORD=${PGPASSWORD}
POSTGRES_DB=${PGDATABASE}
POSTGRES_HOST=${PGHOST}
POSTGRES_PORT=${PGPORT}
POSTGRES_USER=${PGUSER}
POSTGRES_PASSWORD=${PGPASSWORD}
POSTGRES_DB=${PGDATABASE}
Faruq Alli-Balogun
That's easier than I thought! I'd try it out ${PGHOST} as a string should get the right value yeah?
root
root2y ago
It should, if I recall correctly.
Faruq Alli-Balogun
THANK YOU @Brody @aleks
Want results from more Discord servers?
Add your server