Skip to content

Instantly share code, notes, and snippets.

@ericboehs
Last active December 12, 2015 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericboehs/4735037 to your computer and use it in GitHub Desktop.
Save ericboehs/4735037 to your computer and use it in GitHub Desktop.
# config/initializers/better_errors.rb
module BetterErrors
def self.allow_remote
@allow_remote
end
def self.allow_remote=(allow_remote=false)
@allow_remote = allow_remote
end
class Middleware
def call(env)
if local_request?(env) || BetterErrors.allow_remote || ENV['BE_ALLOW_REMOTE']
better_errors_call env
else
@app.call env
end
end
end
end
BetterErrors.allow_remote = true if defined? BetterErrors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment