diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-04-17 09:53:14 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-05-07 15:14:38 +0100 |
commit | 1c553c66be65bd3f3107b26ed7f18e9c1f167b9b (patch) | |
tree | 8b515c4c7983c4fcfcaf8d8d8bd90b5024b690a6 | |
parent | da95c03f9f224ded9e0e3bda2635bcf4f63faf5d (diff) |
Add rack-insightadd_rack_insight
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 8 | ||||
-rw-r--r-- | config/application.rb | 1 | ||||
-rw-r--r-- | config/environments/development.rb | 10 | ||||
-rw-r--r-- | config/general.yml-example | 13 | ||||
-rw-r--r-- | lib/configuration.rb | 3 |
6 files changed, 36 insertions, 0 deletions
@@ -72,6 +72,7 @@ end group :test, :development do gem 'bullet', '~> 4.14.6' gem 'factory_girl_rails', '~> 1.7' + gem 'rack-insight', '~> 0.6.3' gem 'rspec-rails', '~> 2.13.2' gem 'spork-rails', '~> 3.2.1' end diff --git a/Gemfile.lock b/Gemfile.lock index b9e0f3380..bd65e8f95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,12 +188,18 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) + rack-insight (0.6.3) + rack + rack-toolbar (>= 0.1.4) + sqlite3 (>= 1.3.3) + uuidtools (>= 2.1.2) rack-protection (1.5.0) rack rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) + rack-toolbar (0.1.4) rails (3.2.21) actionmailer (= 3.2.21) actionpack (= 3.2.21) @@ -289,6 +295,7 @@ GEM unicode (0.4.4) unidecoder (1.1.2) uniform_notifier (1.9.0) + uuidtools (2.1.5) vpim (13.11.11) webrat (0.7.3) nokogiri (>= 1.2.0) @@ -342,6 +349,7 @@ DEPENDENCIES pry (~> 0.9.6) quiet_assets (~> 1.0.2) rack (~> 1.4.5) + rack-insight (~> 0.6.3) rails (= 3.2.21) rails-i18n (~> 0.7.3) rake (= 0.9.2.2) diff --git a/config/application.rb b/config/application.rb index 472077f06..a16e5eb0a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -77,6 +77,7 @@ module Alaveteli ENV['RECAPTCHA_PUBLIC_KEY'] = ::AlaveteliConfiguration::recaptcha_public_key ENV['RECAPTCHA_PRIVATE_KEY'] = ::AlaveteliConfiguration::recaptcha_private_key + # Insert a bit of middleware code to prevent uneeded cookie setting. require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions" config.middleware.insert_before ::ActionDispatch::Cookies, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true diff --git a/config/environments/development.rb b/config/environments/development.rb index b334a1e19..b77fa2fe9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -54,4 +54,14 @@ Alaveteli::Application.configure do Bullet.add_footer = true end end + + if AlaveteliConfiguration.use_rack_insight_in_development + config.middleware.insert_before ::WhatDoTheyKnow::StripEmptySessions, + Rack::Insight::App, + :secret_key => AlaveteliConfiguration.rack_insight_secret_key, + :database_path => AlaveteliConfiguration.rack_insight_database_path, + :password => nil, + :ip_masks => false + end + end diff --git a/config/general.yml-example b/config/general.yml-example index a6980b71c..76640380d 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -681,6 +681,19 @@ USE_MAILCATCHER_IN_DEVELOPMENT: true # --- USE_BULLET_IN_DEVELOPMENT: false +# Debugging toolbar for Rack applications +# https://github.com/pboling/rack-insight +# +# USE_RACK_INSIGHT_IN_DEVELOPMENT - Boolean (default: false) +# +# Examples: +# +# USE_RACK_INSIGHT_IN_DEVELOPMENT: true +# RACK_INSIGHT_SECRET_KEY: some-secret-key +# RACK_INSIGHT_DATABASE_PATH: /tmp/rack_insight.sqlite +# --- +USE_RACK_INSIGHT_IN_DEVELOPMENT: false + # Use memcached to cache HTML fragments for better performance. This will # only have an effect in environments where # config.action_controller.perform_caching is set to true diff --git a/lib/configuration.rb b/lib/configuration.rb index 89f148602..5daf34bb5 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -88,6 +88,9 @@ module AlaveteliConfiguration :VARNISH_HOST => '', :WORKING_OR_CALENDAR_DAYS => 'working', :USE_BULLET_IN_DEVELOPMENT => false + :USE_RACK_INSIGHT_IN_DEVELOPMENT => false, + :RACK_INSIGHT_SECRET_KEY => 'this default is insecure as code is open source, please override in config/general', + :RACK_INSIGHT_DATABASE_PATH => 'tmp/rack_insight.sqlite' } end |