我想将ActionCable配置为使用Heroku。
我已尝试将cable.yml
文件更改为cable.yml.erb
,因此我可以评估ENV['REDISTOGO_URL']
,如下所示:
cable.yml.erb:
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: <%= ENV["REDISTOGO_URL"] %>
但现在我收到以下错误:
2016-11-23T02:24:20.551375+00:00 app[web.1]: E, [2016-11-23T02:24:20.551320 #4] ERROR -- : There was an exception - NoMethodError(undefined method `fetch' for nil:NilClass)
2016-11-23T02:24:20.551478+00:00 app[web.1]: E, [2016-11-23T02:24:20.551408 #4] ERROR -- : /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/configuration.rb:24:in `pubsub_adapter'
2016-11-23T02:24:20.551480+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/base.rb:72:in `block in pubsub'
2016-11-23T02:24:20.551481+00:00 app[web.1]: /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
2016-11-23T02:24:20.551482+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/actioncable-5.0.0.1/lib/action_cable/server/base.rb:72:in `pubsub'
如果我对网址进行硬编码,则可以正常工作:
cable.yml:
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://redistogo:xyz42@sculpin.redistogo.com:10903/
但我认为我不应该提交实际的网址。
到底有没有?
注意:我发现了this块代码,看起来它可能会有所帮助,但我不确定。
我的项目位于mbigras/depot
答案 0 :(得分:1)
尝试将cable.yml.erb
重命名为cable.yml
。
在我的本地机器上它对我有用:
development:
adapter: redis
url: <%= ENV["REDIS_URL"] %>