2

是否可以使用 JDBC Postgres (jRuby) 驱动程序而不在 database.yml 文件中指定用户名和密码?我的项目数据库文件目前是:

test: &test
  adapter: postgresql
  encoding: unicode
  database: app_test
  pool: 5

development: &development
  adapter: postgresql
  encoding: unicode
  database: app_development
  pool: 5

production: &production
  adapter: postgresql
  encoding: unicode
  database: app_production
  pool: 5

cucumber:
  <<: *test

但是,这会在启动服务器/控制台时导致以下错误:

ActiveRecord::JDBCError: 驱动程序遇到未知错误: FATAL: no PostgreSQL user name specified in startup packet

如果可能,最好不要在 database.yml 配置文件中包含用户名和密码(这适用于 MRI 和pggem)。每个团队成员都使用不同的用户名进行本地安装。

4

0 回答 0