Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails Application Structure | GoRails

Chris Oliver asked in General

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.

Reply

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.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,842+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.