Moh*_*out 3 deployment ruby-on-rails heroku mongoid mongohq
我添加了生产数据库如下:
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
consistency: :strong
max_retries: 1
retry_interval: 0
Run Code Online (Sandbox Code Playgroud)
取决于以下文档.
我MONGOHQ_URL通过以下命令创建:
heroku config:add MONGOHQ_URL=mongodb://user:pass@server.mongohq.com:port/db_name
Run Code Online (Sandbox Code Playgroud)
但当我打开控制台时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)
Run Code Online (Sandbox Code Playgroud)
如何在mongoid.yml文件中添加生产配置以使用heroku进行部署?
Rya*_*yan 13
他们更新了Mongoid 5中mongoid.yml文件的格式.而不是sessions它需要clients.还有其他一些变化,我知道user并且password现在嵌套在不同于之前的选项中.有关详细信息,请参阅Mongoid文档.
production:
clients:
default:
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2388 次 |
| 最近记录: |