1

I've never really been a database guy. I'm using Postgres and in my database.yml, I have:

test:
  adapter: postgresql
  encoding: unicode
  database: blog_test
  pool: 5
  username: blog
  password: <%= ENV['POSTGRES_PASSWORD'] %>
development:
  adapter: postgresql
  encoding: unicode
  database: blog_development
  pool: 5
  username: blog
  password: <%= ENV['POSTGRES_PASSWORD'] %>
production:
  adapter: postgresql
  encoding: unicode
  database: blog_production
  pool: 5
  username: blog
  password: <%= ENV['POSTGRES_PASSWORD'] %>

I'm pushing this to heroku soon and just have a few concerns. Here are my questions (they may be dumb questions but I couldn't find anything on google that addresses this in a simple way):

1. Will heroku set this up for me using my herokue password? Should I just leave this file as is?

2. How can I test that my database is secured by a password?

3. What's the point of even having this file? Am I not the only one that can easily access my Rails files (without hacking ofcourse)?

Thank you in advance. I'm using postgresapp & am deploying on heroku

3 Answers 3

3

Might be worth checking out Heroku Postgres documentation. The key point is that when you upload to Heroku, Heroku replaces the database.yml file with an automatically generated one that handles the setup. The only point to the database.yml file you have locally is to manage connections to your development and test databases (and a local production one, if you choose to have some sort of local staging environment or whatnot).

Sign up to request clarification or add additional context in comments.

Comments

2

You can remove the production entry from your database.yml file.

When Rails applications are deployed to Heroku a database.yml file is automatically generated for your application that configures ActiveRecord to use a PostgreSQL connection and to connect to the database located at DATABASE_URL.

https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-rails

Comments

2

Heroku actually overwrites yourdatabase.yml with its own when you deploy. This means you don't have to worry about any db name/username/pw etc.

That stuff does exist and is accessible if you need it, but by default Heroku "knows" about it and will setup your connection automatically.

If you want to take a look at your DB you can go here: https://postgres.heroku.com/databases. That will give you the database's name and login credentials for your app.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.