diff options
author | schneems <richard.schneeman@gmail.com> | 2013-11-11 15:56:09 -0500 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2013-12-19 21:41:52 -0500 |
commit | dece621a21a84ab3c4c59d440694952421322317 (patch) | |
tree | 2c65d8e4580ffe77059c3bcecbee87ba5784c2de /guides/code/getting_started/config | |
parent | e4cde5d58cbb09d1843796f96ba86225ff94fe05 (diff) | |
download | rails-dece621a21a84ab3c4c59d440694952421322317.tar.gz rails-dece621a21a84ab3c4c59d440694952421322317.tar.bz2 rails-dece621a21a84ab3c4c59d440694952421322317.zip |
Do not expect database user with app name to exist
By default when creating a project with `--database=postgresql` the `config/database.yml` file that is generated has a user specified that is the same as the app name
```
development:
adapter: postgresql
encoding: unicode
database: <%= app_name %>_development
pool: 5
username: <%= app_name %>
password:
```
This is counterintuitive and would rarely be valid. By default postgres creates a user with the current user name (http://www.postgresql.org/docs/9.3/static/database-roles.html) "it will have the same name as the operating system user that initialized the database cluster":
```
$ whoami
schneems
```
If the `username` is left out postgresql will assume that you wish to log in as the default user
```
$ psql -c '\du'
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
schneems | Superuser, Create role, Create DB, Replication | {}
```
A good sensible default then for auto generated `database.yml` files is to remove the `username`, and have postgres attempt to connect to the database as the currently logged in user.
Instead of submitting with a blank password, don't submit a password.
Diffstat (limited to 'guides/code/getting_started/config')
0 files changed, 0 insertions, 0 deletions