Unable to set PostGIS template environment variables correctly
I'm setting all the required env vars :
but it keeps showing that these vars are required.
The second this is that when I try to connect to the database using the env vars I used it says either the password is wrong ( and database doesn't exist in other cases)
22 Replies
Project ID:
2fe6b2a5-c072-4ea0-ab34-43e08ee347f9
2fe6b2a5-c072-4ea0-ab34-43e08ee347f9
is this a database included with a template? if so please link the template
I created an app service in the project, then I needed a DB with PostGIS installed so I used PostGIS Template, the docker images being is
postgis
so basically just adding those env variables new default user and db should be created, but not so sure it's happening, besides why does the Data
tab keeps showing Required Variables
component even if the DB is actually configured with default values? what should happen once they are all set !can you connect to the database just fine?
with default values yes, but not when I set new ones
why are you changing variables on the database?
I need to set my own
values
whats wrong with the values the database comes with?
well my db won't be called
railway
neither my db user, and I suppose they should be configurable aren't they ? postgis
is based on postgres
images which allows to set those env variables (thing you did in PostGIS template)
the question is : are those env variables overwritten in the PostGIS Template when configured !theyre set on first deploy, changing them after the fact will only cause issues, but i really cant see why you need to change them
reference the variables in your service and use the values as is https://docs.railway.app/develop/variables#reference-variables
so I should keep the same DB and user names in my app right !!!!
well i'm sorry but it doesn't make too much sense
first thing is that you have made them configurable
2nd you can't force a customer using your own default naming conventions in a configurabale component, it just doesn't make sense !!
please chill, i dont work for railway
you should be using environment variables, do not hardcode any database names, usernames, or passwords
I'm not hard coding anything, I was just trying to changes values for those env variables and use them to connect to Db from my app service, it's as simple as that
who does than π
!
I just want to make sure resetting those env variables in a PostGIS Template works as intended !
as a hobby user you get community support! pro plan users and above get support from the team
but besides that, that is simply how that docker image works, and like i said, the values they come with should not matter as long as your code uses environment variables properly
im just trying to help you come to the proper solution
I appreciate the help man, but still not sure if you got what I was trying to do, I never used hard coded values, I just changed the default values PostGIS template comes with, and by doing that in the next deployment, a new default DB and User (from the new values) should be created
then using those same values also as env vars from my app service
i get what youre trying to do, but i dont understand why, did you leak the database credentials?
either way, if the image isnt setting the new variables that kinda out of railway's hands, railway does not maintain that image
voila thank you
btw I pulled the postgis image from docker hub locally, set those env vars and I was able to connect to the db using the values I used π
I wanted to know whether there is something wrong with Railway Api or not
unless you leaked the password, i just dont see why you need to change them
the password is not really leaked, but I just don't want the whole world to know my db name and user π
and I think this why postgres image made those env vars configurable
ive been here a long time, you are the first to worry about this
maybe because I've played a lot of CTFs xD
anyway thanks a lot for your help @Brody