Skip to main content

Rails Application Structure | GoRails

General • Asked by Chris Oliver

Hey Chris, at 5:10 you mention setting a username and password for your database. Can you expand on that? I looked at my own heroku account and I just see a postgres url for my config variables. Do I just set a username and password for it like setting env variables for AWS S3 with the figaro gem? Also, is it not secure otherwise? Thanks! Tried looking up more on this on http://guides.rubyonrails.o... but didn't find anything.

When you configure your database for the first time, you're asked what user and password owns it. This is how it gets protected. Almost all services you use that configure the database for you like Heroku, will have generated a username and password for it. That's inside the URL at the beginning before the @ and separated by a :. You just use the URL they give you but when you're using your own local database or whatever, you must use the username and password you set while setting up the database. You almost always want a password to lock it down so no random people can access your data.

For your own database, you'll just modify the database.yml to use those separate parameters instead of a url because it's easier formatting.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.