postgresql - How is my Ruby on Rails app able to access the database without the password? -
i'm getting started ruby on rails. i'm building hello world app , i'm using postgresql. used following command create app:
rails new rails-hw -d postgresql
i created database user using createuser -s pguser
, set password.
i edited development section of config/database.yml, using username , password of user created. however, seems use password in database.yml file doesn't matter , app able access data in database. why ignoring password?
because current postgres installation configured allow connections localhost.
check pg_hba.conf
you'll find this:
# type database user ip-address ip-mask method host 127.0.0.1 255.255.255.255 trust
which says "allow connections postgres users , databases 127.0.0.1."
more specifics can found in docs: http://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html (see example 20-1)
Comments
Post a Comment