【发布时间】:2015-11-01 18:26:34
【问题描述】:
我添加了生产数据库如下:
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
consistency: :strong
max_retries: 1
retry_interval: 0
依赖于以下docs。
我通过以下命令创建了MONGOHQ_URL:
heroku config:add MONGOHQ_URL=mongodb://user:pass@server.mongohq.com:port/db_name
但是当我通过heroku run rails c 打开控制台时。我得到了以下信息:
There is a configuration error with the current mongoid.yml.
message:
No clients configuration provided.
summary:
Mongoid's configuration requires that you provide details about each client that can be connected to, and requires in the clients config at least 1 default client to exist.
resolution:
Double check your mongoid.yml to make sure that you have a top-level clients key with at least 1 default client configuration for it. You can regenerate a new mongoid.yml for assistance via `rails g mongoid:config`.
Example:
development:
clients:
default:
database: mongoid_dev
hosts:
- localhost:27017
Loading production environment (Rails 4.2.4)
如何在 mongoid.yml 文件中添加生产配置以使用 heroku 进行部署?
【问题讨论】:
-
可能存在重复的here
标签: ruby-on-rails heroku deployment mongoid mongohq