Commit c0b20bb8143b93cec3eb7f7b144e5f080fd2141c

Authored by Nathan Broadbent
1 parent 085ef265
Exists in master and in 1 other branch production

Made RackSslEnforcer configurable via the 'enforce_ssl' key in config.yml, turned off by default.

config/application.rb
@@ -15,9 +15,6 @@ Bundler.require(:default, Rails.env) if defined?(Bundler) @@ -15,9 +15,6 @@ Bundler.require(:default, Rails.env) if defined?(Bundler)
15 15
16 module Errbit 16 module Errbit
17 class Application < Rails::Application 17 class Application < Rails::Application
18 -  
19 - config.middleware.use Rack::SslEnforcer, :except => /^\/deploys/  
20 -  
21 # Settings in config/environments/* take precedence over those specified here. 18 # Settings in config/environments/* take precedence over those specified here.
22 # Application configuration should go into files in config/initializers 19 # Application configuration should go into files in config/initializers
23 # -- all .rb files in that directory are automatically loaded. 20 # -- all .rb files in that directory are automatically loaded.
config/config.example.yml
@@ -11,6 +11,9 @@ @@ -11,6 +11,9 @@
11 # The host of your errbit server 11 # The host of your errbit server
12 host: errbit.example.com 12 host: errbit.example.com
13 13
  14 +# Enforce SSL connections
  15 +enforce_ssl: false
  16 +
14 # The email address which email notifications 17 # The email address which email notifications
15 # will be sent from. 18 # will be sent from.
16 email_from: errbit@example.com 19 email_from: errbit@example.com
config/initializers/ssl_enforcer.rb 0 → 100755
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +#
  2 +# Enforce SSL connections, if configured
  3 +if Errbit::Config.enforce_ssl
  4 + Errbit::Application.configure do
  5 + config.middleware.use Rack::SslEnforcer, :except => /^\/deploys/
  6 + end
  7 +end