david
david copied to clipboard
David ignores config.coap.only in Rails 5.2
I am using david alongside puma to provide a CoAP + HTTP API with Rails 5.2.
While running puma, I noticed that the coap.only option inside my application.rb is ignored on server startup and important middleware classes like Rack::MethodOverride and ActionDispatch::ShowExceptions get removed. That is because in david's default config coap.only is set to true and the options set in application.rb are not yet evaluated at the time the HTTP middleware gets removed.
For everyone who experiences the same issue, I solved this by patching david's default config by placing
require 'david/railties/config'
David::Railties::Config.class_eval do
config.coap.only = false
end
before the Bundler.require(*Rails.groups) line in my application.rb.
Cheers, Alex