Reputation: 2280
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
Upvotes: 1
Views: 1202
Reputation: 4344
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).
Upvotes: 3
Reputation: 9025
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.
Upvotes: 2
Reputation: 10359
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
Upvotes: 2