diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 5 | ||||
-rw-r--r-- | config/crontab.ugly | 2 | ||||
-rw-r--r-- | config/database.yml-example | 2 | ||||
-rw-r--r-- | config/environment.rb | 1 | ||||
-rw-r--r-- | config/httpd.conf-example (renamed from config/httpd.conf) | 7 | ||||
-rw-r--r-- | config/initializers/alaveteli.rb | 17 | ||||
-rw-r--r-- | config/initializers/secret_token.rb | 7 | ||||
-rw-r--r-- | config/initializers/theme_loader.rb | 21 | ||||
l--------- | config/locales | 1 | ||||
-rw-r--r-- | config/packages | 3 | ||||
-rw-r--r-- | config/routes.rb | 9 | ||||
-rw-r--r-- | config/test.yml | 5 |
12 files changed, 58 insertions, 22 deletions
diff --git a/config/application.rb b/config/application.rb index f5b525a36..92fd30685 100644 --- a/config/application.rb +++ b/config/application.rb @@ -55,8 +55,11 @@ module Alaveteli # will be in this time zone config.time_zone = ::AlaveteliConfiguration::time_zone - config.after_initialize do + config.after_initialize do |app| require 'routing_filters.rb' + # Add a catch-all route to force routing errors to be handled by the application, + # rather than by middleware. + app.routes.append{ match '*path', :to => 'general#not_found' } end config.autoload_paths << "#{Rails.root.to_s}/lib/mail_handler" diff --git a/config/crontab.ugly b/config/crontab.ugly index ef3455113..d33450df4 100644 --- a/config/crontab.ugly +++ b/config/crontab.ugly @@ -2,7 +2,7 @@ # Timed tasks for FOI site. Template file. # # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org. WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org. WWW: http://www.mysociety.org/ PATH=/usr/local/bin:/usr/bin:/bin MAILTO=cron-!!(*= $site *)!!@mysociety.org diff --git a/config/database.yml-example b/config/database.yml-example index b1597e6fe..e48577f23 100644 --- a/config/database.yml-example +++ b/config/database.yml-example @@ -19,6 +19,8 @@ test: password: <password> host: localhost port: 5432 +# Uncomment the following if the user is not a postgres superuser +# constraint_disabling: false production: adapter: postgresql diff --git a/config/environment.rb b/config/environment.rb index d2e2bc9d1..196680b23 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,4 +3,3 @@ require File.expand_path('../application', __FILE__) # Initialize the rails application Alaveteli::Application.initialize! - diff --git a/config/httpd.conf b/config/httpd.conf-example index acf37d97c..06170a5e2 100644 --- a/config/httpd.conf +++ b/config/httpd.conf-example @@ -4,7 +4,7 @@ # Ruby on Rails application. # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org +# Email: hello@mysociety.org; WWW: http://www.mysociety.org # This is needed for the PHP spell checker <Location /fcgi> @@ -50,7 +50,12 @@ RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/(html/)?\d+/.+) /views PassengerResolveSymlinksInDocumentRoot on # Recommend setting this to 3 or less on servers with 512MB RAM PassengerMaxPoolSize 6 + # The RackEnv variable applies to Rails 3 applications, while + # the RailsEnv variable applies to applications for earlier + # versions of Rails. There doesn't seem to be any harm in + # setting both, however. RailsEnv production + RackEnv production </IfModule> # Gzip font resources diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 458201164..263e5cf7b 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -10,7 +10,7 @@ load "debug_helpers.rb" load "util.rb" # Application version -ALAVETELI_VERSION = '0.8' +ALAVETELI_VERSION = '0.10' # Add new inflection rules using the following format # (all these examples are active by default): @@ -29,6 +29,10 @@ ALAVETELI_VERSION = '0.8' # Domain for URLs (so can work for scripts, not just web pages) ActionMailer::Base.default_url_options[:host] = AlaveteliConfiguration::domain +# https links in emails if forcing SSL +if AlaveteliConfiguration::force_ssl + ActionMailer::Base.default_url_options[:protocol] = "https" +end # fallback locale and available locales available_locales = AlaveteliConfiguration::available_locales.split(/ /) @@ -39,15 +43,11 @@ I18n.locale = default_locale I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym} I18n.default_locale = default_locale -# Customise will_paginate URL generation -WillPaginate::ViewHelpers.pagination_options[:renderer] = 'WillPaginateExtension::LinkRenderer' - # Load monkey patches and other things from lib/ require 'ruby19.rb' require 'activesupport_cache_extensions.rb' require 'use_spans_for_errors.rb' require 'activerecord_errors_extensions.rb' -require 'willpaginate_extension.rb' require 'i18n_fixes.rb' require 'world_foi_websites.rb' require 'alaveteli_external_command.rb' @@ -55,3 +55,10 @@ require 'quiet_opener.rb' require 'mail_handler' require 'public_body_categories' require 'ability' +require 'normalize_string' +require 'alaveteli_file_types' + +# Allow tests to be run under a non-superuser database account if required +if Rails.env == 'test' and ActiveRecord::Base.configurations['test']['constraint_disabling'] == false + require 'no_constraint_disabling' +end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index f82348169..d120b94ae 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,9 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Alaveteli::Application.config.secret_token = AlaveteliConfiguration::cookie_store_session_secret + +# Just plopping an extra character on the secret_token so that any sessions on upgrading from +# Rails 2 to Rails 3 version of Alaveteli are invalidated. +# See http://blog.carbonfive.com/2011/03/19/rails-3-upgrade-tip-invalidate-session-cookies/ + +Alaveteli::Application.config.secret_token = "3" + AlaveteliConfiguration::cookie_store_session_secret diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index 4c8967c97..1ad2d01f1 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -2,12 +2,23 @@ # It is used by our config/routes.rb to decide which route extension files to load. $alaveteli_route_extensions = [] -if ENV["RAILS_ENV"] != "test" # Don't let the themes interfere with Alaveteli specs +def require_theme(theme_name) + theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ + if File.exists? theme_main_include + require theme_main_include + end +end + +if Rails.env == "test" + # By setting this ALAVETELI_TEST_THEME to a theme name, theme tests can run in the Rails + # context with the theme loaded. Otherwise the themes from the config aren't loaded in testing + # so they don't interfere with core Alaveteli tests + if defined? ALAVETELI_TEST_THEME + require_theme(ALAVETELI_TEST_THEME) + end +else for url in AlaveteliConfiguration::theme_urls.reverse theme_name = url.sub(/.*\/(.*).git/, "\\1") - theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ - if File.exists? theme_main_include - require theme_main_include - end + require_theme(theme_name) end end diff --git a/config/locales b/config/locales deleted file mode 120000 index 10a4f96c3..000000000 --- a/config/locales +++ /dev/null @@ -1 +0,0 @@ -../vendor/rails-locales/rails/locale
\ No newline at end of file diff --git a/config/packages b/config/packages index db51e5bdd..fc67cda6b 100644 --- a/config/packages +++ b/config/packages @@ -36,4 +36,5 @@ rake (>= 0.9.2.2) build-essential bundler sqlite3 -libsqlite3-dev
\ No newline at end of file +libsqlite3-dev +libicu-dev diff --git a/config/routes.rb b/config/routes.rb index b45ff17f5..bc03d91e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,9 @@ +# encoding: UTF-8 # config/routes.rb: # Mapping URLs to controllers for FOIFA. # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ # Allow easy extension from themes. Note these will have the highest priority. $alaveteli_route_extensions.each do |f| @@ -23,8 +24,6 @@ Alaveteli::Application.routes.draw do match '/search/*combined/all' => 'general#search', :as => :search_general, :view => 'all' match '/search(/*combined)' => 'general#search', :as => :search_general match '/advancedsearch' => 'general#search_redirect', :as => :advanced_search, :advanced => true - - match '/random' => 'general#random_request', :as => :random_request ##### ##### Request controller @@ -51,8 +50,8 @@ Alaveteli::Application.routes.draw do match '/request/:url_title/describe/:described_state' => 'request#describe_state_message', :as => :describe_state_message match '/request/:id/response' => 'request#show_response', :as => :show_response_no_followup match '/request/:id/response/:incoming_message_id' => 'request#show_response', :as => :show_response - match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :as => :get_attachment_as_html - match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :as => :get_attachment + match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :format => false, :as => :get_attachment_as_html + match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :format => false, :as => :get_attachment match '/request_event/:info_request_event_id' => 'request#show_request_event', :as => :info_request_event diff --git a/config/test.yml b/config/test.yml index fbec24346..5c08e928b 100644 --- a/config/test.yml +++ b/config/test.yml @@ -13,6 +13,11 @@ SITE_NAME: 'Alaveteli' # It makes things simpler if this is the same as the Rails test domain test.host DOMAIN: 'test.host' +# If true forces everyone (in the production environment) to use encrypted connections +# (via https) by redirecting unencrypted connections. This is *highly* recommended +# so that logins can't be intercepted by naughty people. +FORCE_SSL: false + # ISO country code of country currrently deployed in # (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO_COUNTRY_CODE: DE |