the-road-to-graphql / fullstack-apollo-express-postgresql-boilerplate

💥 A sophisticated GraphQL with Apollo, Express and PostgreSQL boilerplate project.
https://roadtoreact.com
MIT License
1.2k stars 263 forks source link

Use only DATABASE_URL #53

Open morenoh149 opened 5 years ago

morenoh149 commented 5 years ago

the Heroku section instructs the user to add code for DATABASE_URL https://www.robinwieruch.de/graphql-apollo-server-tutorial/#graphql-server-postgresql-deployment-heroku

The DATABASE_URL env var is widely used. It would make more sense to specify this from the very beginning instead of three env vars

DATABASE=mydatabase
DATABASE_USER=postgres
DATABASE_PASSWORD=postgres

Make api only use DATABASE_URL.

rwieruch commented 5 years ago

Good point. Can the local PostgreSQL database be used with a database URL only even though you have set up a superuser for it?

morenoh149 commented 5 years ago

I'm not sure. I use DATABASE_URL in two ways, postgres://localhost:5432/dbname and postgres://username:password@localhost:5432/dbname. If you need to specify the superuser use the latter, otherwise my system accepts my non-root user with the former.

rwieruch commented 5 years ago

Good to know. I will take this into account for the next edition of the book!