Allow Middleware.enabled to override the mode

Middleware.enabled should be able to override the default mode, if it is a proc.

@camilo for review.