I have a middleware for announcing my application on the local network app using Bonjour, but it's also announcing the service when Rails is invoked from rake or through the console.
I'd like to exclude these cases, and only use the Bonjour middleware when Rails is running as a server.
The middleware configuration accepts a proc to exclude middlewares under certain conditions using a proc
:
config.middleware.insert_before ActionDispatch::Static, Rack::SSL, :exclude => proc { |env|
env['HTTPS'] != 'on'
}
But how do I determine if Rails was invoked from the CLI, console or as a server?