diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/alert-tracks-debian.ugly | 2 | ||||
-rw-r--r-- | config/boot.rb | 2 | ||||
-rw-r--r-- | config/crontab.ugly | 2 | ||||
-rw-r--r-- | config/custom-routes.rb | 1 | ||||
-rw-r--r-- | config/environment.rb | 16 | ||||
-rw-r--r-- | config/general.yml | 118 | ||||
-rw-r--r-- | config/general.yml-example | 30 | ||||
-rw-r--r-- | config/httpd.conf | 17 | ||||
-rw-r--r-- | config/routes.rb | 34 |
9 files changed, 209 insertions, 13 deletions
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly index 730a125b4..5bd146061 100644 --- a/config/alert-tracks-debian.ugly +++ b/config/alert-tracks-debian.ugly @@ -32,7 +32,7 @@ start_daemon() { } stop_daemon() { - /sbin/start-stop-daemon --stop --pidfile "$PIDFILE" + /sbin/start-stop-daemon --stop --oknodo --pidfile "$PIDFILE" } restart() { stop; start; } diff --git a/config/boot.rb b/config/boot.rb index 90fd9cd4d..0f5e661ed 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -31,7 +31,7 @@ module Rails end def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") + File.exist?("#{RAILS_ROOT}/vendor/rails/Rakefile") end def preinitialize diff --git a/config/crontab.ugly b/config/crontab.ugly index ecd3151ff..5f2fbdb3b 100644 --- a/config/crontab.ugly +++ b/config/crontab.ugly @@ -28,7 +28,7 @@ MAILTO=cron-!!(*= $site *)!!@mysociety.org 2 4 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/check-recent-requests-sent.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/check-recent-requests-sent || echo "stalled?" 45 3 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/stop-new-responses-on-old-requests.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/stop-new-responses-on-old-requests || echo "stalled?" # Only root can restart apache -31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/compact-xapian-database.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production || echo "stalled?" +31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/compact-xapian-database.lock "/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production" || echo "stalled?" # Once a day on all servers diff --git a/config/custom-routes.rb b/config/custom-routes.rb new file mode 100644 index 000000000..16b3c6b0c --- /dev/null +++ b/config/custom-routes.rb @@ -0,0 +1 @@ +#Â Placeholder to be overriden by themes if necessary
\ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb index 17a16efed..91839c043 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,7 +6,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -28,6 +28,12 @@ load "config.rb" load "format.rb" load "debug_helpers.rb" load "util.rb" +# Patch Rails::GemDependency to cope with older versions of rubygems, e.g. in Debian Lenny +# Restores override removed in https://github.com/rails/rails/commit/c20a4d18e36a13b5eea3155beba36bb582c0cc87 +# without effecting method behaviour +# and adds fallback gem call removed in https://github.com/rails/rails/commit/4c3725723f15fab0a424cb1318b82b460714b72f +require File.join(File.dirname(__FILE__), '../lib/old_rubygems_patch') + Rails::Initializer.run do |config| # Load intial mySociety config @@ -55,6 +61,7 @@ Rails::Initializer.run do |config| config.gem "gettext", :version => '>=1.9.3' config.gem "fast_gettext", :version => '>=0.4.8' config.gem "rack", :version => '1.1.0' + config.gem "rdoc", :version => '>=2.4.3' config.gem "recaptcha", :lib => "recaptcha/rails" config.gem 'rspec', :lib => false, :version => '1.3.1' config.gem 'rspec-rails', :lib => false, :version => '1.3.3' @@ -103,7 +110,7 @@ ActionMailer::Base.default_url_options[:host] = MySociety::Config.get("DOMAIN", # So that javascript assets use full URL, so proxied admin URLs read javascript OK if (MySociety::Config.get("DOMAIN", "") != "") ActionController::Base.asset_host = Proc.new { |source, request| - if request.fullpath.match(/^\/admin\//) + if ENV["RAILS_ENV"] != "test" && request.fullpath.match(/^\/admin\//) MySociety::Config.get("ADMIN_PUBLIC_URL", "") else MySociety::Config.get("DOMAIN", 'localhost:3000') @@ -123,7 +130,7 @@ end FastGettext.default_available_locales = available_locales I18n.locale = default_locale -I18n.available_locales = available_locales +I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym} I18n.default_locale = default_locale # Load monkey patches and other things from lib/ @@ -137,3 +144,6 @@ require 'willpaginate_hack.rb' require 'sendmail_return_path.rb' require 'tnef.rb' require 'i18n_fixes.rb' +require 'rack_quote_monkeypatch.rb' +require 'world_foi_websites.rb' +require 'alaveteli_external_command.rb' diff --git a/config/general.yml b/config/general.yml new file mode 100644 index 000000000..7c70f8e71 --- /dev/null +++ b/config/general.yml @@ -0,0 +1,118 @@ +# general.yml-example: +# Example values for the "general" config file. +# +# Configuration parameters, in YAML syntax. +# +# Copy this file to one called "general.yml" in the same directory. Or +# have multiple config files and use a symlink to change between them. + +# Site name appears in various places throughout the site +SITE_NAME: 'Alaveteli' + +# Domain used in URLs generated by scripts (e.g. for going in some emails) +DOMAIN: 'localhost:3000' + +# ISO country code of country currrently deployed in +# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +ISO_COUNTRY_CODE: DE + +# These feeds are displayed accordingly on the Alaveteli "blog" page: +BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/' +TWITTER_USERNAME: 'alaveteli_foi' + +# Locales we wish to support in this app, space-delimited +AVAILABLE_LOCALES: 'en' +DEFAULT_LOCALE: 'en' + +# if 'true', respect the user's choice of language in the browser +USE_DEFAULT_BROWSER_LANGUAGE: true + +# How many days should have passed before an answer to a request is officially late? +REPLY_LATE_AFTER_DAYS: 20 +REPLY_VERY_LATE_AFTER_DAYS: 40 +# We give some types of authority like schools a bit longer than everyone else +SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60 + +# example searches for the home page, semicolon delimited. +FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking' + +# example public bodies for the home page, semicolon delimited - short_names +FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq' + +# URL of theme to install (when running rails-post-deploy script) +THEME_URL: 'git://github.com/sebbacon/alavetelitheme.git' + + +## Incoming email +# Your email domain, e.g. 'foifa.com' +INCOMING_EMAIL_DOMAIN: 'localhost' + +# An optional prefix to help you distinguish FOI requests, e.g. 'foi+' +INCOMING_EMAIL_PREFIX: '' + +# used for hash in request email address +INCOMING_EMAIL_SECRET: 'xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx' + +# used as envelope from at the incoming email domain for cases where we don't care about failure +BLACKHOLE_PREFIX: 'do-not-reply-to-this-address' + +## Administration + +# Leave these two blank to skip admin authorisation +ADMIN_USERNAME: 'asd' +ADMIN_PASSWORD: 'qwe' + +# Email "from" details +CONTACT_EMAIL: 'postmaster@localhost' +CONTACT_NAME: 'Alaveteli Webmaster' + +# Where the raw incoming email data gets stored; make sure you back +# this up! +RAW_EMAILS_LOCATION: 'files/raw_emails' + +# The base URL for admin pages. You probably don't want to change this. +ADMIN_BASE_URL: '/admin/' + +# Where /stylesheets sits under for admin pages. See asset_host in +# config/environment.rb. Can be full domain or relative path (not an +# absolute path beginning with /). Again, unlikely to want to change +# this. +ADMIN_PUBLIC_URL: '' + +# Secret key for signing cookie_store sessions +COOKIE_STORE_SESSION_SECRET: 'your secret key here, make it long and random' + +# If present, puts the site in read only mode, and uses the text as reason +# (whole paragraph). Please use a read-only database user as well, as it only +# checks in a few obvious places. +READ_ONLY: '' + +# Doesn't do anything right now. +STAGING_SITE: 1 + +# Recaptcha, for detecting humans. Get keys here: http://recaptcha.net/whyrecaptcha.html +RECAPTCHA_PUBLIC_KEY: '6LcsnMcSAAAAAAL4FqMix7IOsEIwdMh42MuOFztv' +RECAPTCHA_PRIVATE_KEY: '6LcsnMcSAAAAAFjbWcf2dI874as0fmYSAiC9Jgvx' + +# For debugging memory problems. If true, the app logs +# the memory use increase of the Ruby process due to the +# request (Linux only). Since Ruby never returns memory to the OS, if the +# existing process previously served a larger request, this won't +# show any consumption for the later request. +DEBUG_RECORD_MEMORY: false + +# If you have Alaveteli set up behind an HTTP caching proxy +# (accelerator) like Varnish or Squid, you can cause the application +# to purge selected URLs by setting these two variables (see +# `../doc/CACHING.md` for details) +ACCELERATOR_HOST: 'localhost' +ACCELERATOR_PORT: '6081' + +# mySociety's gazeteer service. Shouldn't change. +GAZE_URL: http://gaze.mysociety.org + +# Path to a program that converts a page at a URL to HTML. It should +# take two arguments: the URL, and a path to an output file. A static +# binary of wkhtmltopdf is recommended: +# http://code.google.com/p/wkhtmltopdf/downloads/list +HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
\ No newline at end of file diff --git a/config/general.yml-example b/config/general.yml-example index 3537cd792..8c59b1b0e 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -12,6 +12,10 @@ SITE_NAME: 'Alaveteli' # Domain used in URLs generated by scripts (e.g. for going in some emails) DOMAIN: '127.0.0.1:3000' +# ISO country code of country currrently deployed in +# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +ISO_COUNTRY_CODE: GB + # These feeds are displayed accordingly on the Alaveteli "blog" page: BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/' TWITTER_USERNAME: 'whatdotheyknow' @@ -27,15 +31,15 @@ REPLY_VERY_LATE_AFTER_DAYS: 40 # We give some types of authority like schools a bit longer than everyone else SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60 -# example searches for the home page, semicolon delimited. -FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking' - # example public bodies for the home page, semicolon delimited - short_names FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq' # URL of theme to install (when running rails-post-deploy script) THEME_URL: 'git://github.com/mysociety/whatdotheyknow-theme.git' +# Whether a user needs to sign in to start the New Request process +FORCE_REGISTRATION_ON_NEW_REQUEST: false + ## Incoming email # Your email domain, e.g. 'foifa.com' @@ -60,6 +64,10 @@ ADMIN_PASSWORD: 'passwordx' CONTACT_EMAIL: 'postmaster@localhost' CONTACT_NAME: 'Alaveteli Webmaster' +# Email "from" details for track messages +TRACK_SENDER_EMAIL: 'postmaster@localhost' +TRACK_SENDER_NAME: 'Alaveteli Webmaster' + # Where the raw incoming email data gets stored; make sure you back # this up! RAW_EMAILS_LOCATION: 'files/raw_emails' @@ -91,6 +99,9 @@ STAGING_SITE: 1 RECAPTCHA_PUBLIC_KEY: 'x' RECAPTCHA_PRIVATE_KEY: 'x' +# Number of days after which to send a 'new response reminder' +NEW_RESPONSE_REMINDER_AFTER_DAYS: [3, 10, 24] + # For debugging memory problems. If true, the app logs # the memory use increase of the Ruby process due to the # request (Linux only). Since Ruby never returns memory to the OS, if the @@ -106,3 +117,16 @@ DEBUG_RECORD_MEMORY: false # be another reason to try this setting. USE_GHOSTSCRIPT_COMPRESSION: true +# mySociety's gazeteer service. Shouldn't change. +GAZE_URL: http://gaze.mysociety.org + +# The email address to which non-bounce responses should be forwarded +FORWARD_NONBOUNCE_RESPONSES_TO: user-support@localhost + +# Path to a program that converts a page at a URL to HTML. It should +# take two arguments: the URL, and a path to an output file. A static +# binary of wkhtmltopdf is recommended: +# http://code.google.com/p/wkhtmltopdf/downloads/list +# If the command is not present, a text-only version will be rendered +# instead. +HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
\ No newline at end of file diff --git a/config/httpd.conf b/config/httpd.conf index d5e86478a..47e7f9c72 100644 --- a/config/httpd.conf +++ b/config/httpd.conf @@ -35,4 +35,19 @@ RewriteRule /files/(.+) http://files.whatdotheyknow.com/$1 <IfModule mod_passenger.c> # Set this to something like 100 if you have memory leak issues PassengerMaxRequests 0 -</IfModule>
\ No newline at end of file + PassengerResolveSymlinksInDocumentRoot on + # Recommend setting this to 3 or less on servers with 512MB RAM + PassengerMaxPoolSize 6 +</IfModule> + +# Gzip font resources +<IfModule mod_deflate.c> + <IfModule mod_mime.c> + Addtype font/opentype .otf + Addtype font/opentype .woff + Addtype font/eot .eot + Addtype font/truetype .ttf + </IfModule> + AddOutputFilterByType DEFLATE font/opentype font/truetype font/eot + AddOutputFilterByType DEFLATE image/svg+xml +</IFModule> diff --git a/config/routes.rb b/config/routes.rb index c16c10eb9..48bf92e75 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,12 +7,15 @@ # $Id: routes.rb,v 1.92 2009-10-14 22:01:27 francis Exp $ ActionController::Routing::Routes.draw do |map| - + # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action + + # Allow easy extension from themes. Note these will have the highest priority. + require 'config/custom-routes' map.with_options :controller => 'general' do |general| general.frontpage '/', :action => 'frontpage' @@ -23,7 +26,9 @@ ActionController::Routing::Routes.draw do |map| # Couldn't find a way to do this in routes which also picked up multiple other slashes # and dots and other characters that can appear in search query. So we sort it all # out in the controller. - general.search_general '/search/*combined', :action => 'search' + general.search_general '/search/*combined/requests', :action => 'search', :view => 'requests' + general.search_general '/search/*combined', :action => 'search' + general.advanced_search '/advancedsearch', :action => 'search_redirect', :advanced => true general.random_request '/random', :action => 'random_request' @@ -32,12 +37,19 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'request' do |request| request.request_list_recent '/list/recent', :action => 'list', :view => 'recent' + request.request_list_all '/list/all', :action => 'list', :view => 'all' request.request_list_successful '/list/successful', :action => 'list', :view => 'successful' + request.request_list_unsuccessful '/list/unsuccessful', :action => 'list', :view => 'unsuccessful' + request.request_list_awaiting '/list/awaiting', :action => 'list', :view => 'awaiting' request.request_list '/list', :action => 'list' + request.select_authority '/select_authority', :action => 'select_authority' + request.new_request '/new', :action => 'new' request.new_request_to_body '/new/:url_name', :action => 'new' + request.search_ahead '/request/search_ahead', :action => 'search_typeahead' + request.show_request '/request/:url_title.:format', :action => 'show' request.show_new_request '/request/:url_title/new', :action => 'show' request.details_request '/details/request/:url_title', :action => 'details' @@ -52,6 +64,7 @@ ActionController::Routing::Routes.draw do |map| request.info_request_event '/request_event/:info_request_event_id', :action => 'show_request_event' request.upload_response "/upload/request/:url_title", :action => 'upload_response' + request.download_entire_request '/request/:url_title/download', :action => 'download_entire_request' end @@ -80,18 +93,30 @@ ActionController::Routing::Routes.draw do |map| end map.with_options :controller => 'public_body' do |body| + body.search_ahead_bodies '/body/search_ahead', :action => 'search_typeahead' body.list_public_bodies "/body", :action => 'list' + body.list_public_bodies_default "/body/list/all", :action => 'list' body.list_public_bodies "/body/list/:tag", :action => 'list' body.list_public_bodies_redirect "/local/:tag", :action => 'list_redirect' body.all_public_bodies_csv "/body/all-authorities.csv", :action => 'list_all_csv' - body.show_public_body "/body/:url_name.:format", :action => 'show' + body.show_public_body "/body/:url_name.:format", :action => 'show', :view => 'all' + body.show_public_body_all "/body/:url_name/all", :action => 'show', :view => 'all' + body.show_public_body_successful "/body/:url_name/successful", :action => 'show', :view => "successful" + body.show_public_body_unsuccessful "/body/:url_name/unsuccessful", :action => 'show', :view => "unsuccessful" + body.show_public_body_awaiting "/body/:url_name/awaiting", :action => 'show', :view => "awaiting" body.view_public_body_email "/body/:url_name/view_email", :action => 'view_email' + body.show_public_body_tag "/body/:url_name/:tag", :action => 'show' + body.show_public_body_tag_view "/body/:url_name/:tag/:view", :action => 'show' end map.with_options :controller => 'comment' do |comment| comment.new_comment "/annotate/request/:url_title", :action => 'new', :type => 'request' end + map.with_options :controller => 'services' do |service| + service.other_country_message "/country_message", :action => 'other_country_message' + end + map.with_options :controller => 'track' do |track| # /track/ is for setting up an email alert for the item # /feed/ is a direct RSS feed of the item @@ -111,6 +136,7 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'help' do |help| help.help_unhappy '/help/unhappy/:url_title', :action => 'unhappy' help.help_about '/help/about', :action => 'about' + help.help_alaveteli '/help/alaveteli', :action => 'alaveteli' help.help_contact '/help/contact', :action => 'contact' help.help_officers '/help/officers', :action => 'officers' help.help_requesting '/help/requesting', :action => 'requesting' @@ -179,7 +205,9 @@ ActionController::Routing::Routes.draw do |map| user.admin_user_list_banned '/admin/user/banned', :action => 'list_banned' user.admin_user_show '/admin/user/show/:id', :action => 'show' user.admin_user_edit '/admin/user/edit/:id', :action => 'edit' + user.admin_user_show '/admin/user/show_bounce_message/:id', :action => 'show_bounce_message' user.admin_user_update '/admin/user/update/:id', :action => 'update' + user.admin_user_clear_bounce '/admin/user/clear_bounce/:id', :action => 'clear_bounce' user.admin_user_destroy_track '/admin/user/destroy_track', :action => 'destroy_track' user.admin_user_login_as '/admin/user/login_as/:id', :action => 'login_as' user.admin_clear_profile_photo '/admin/user/clear_profile_photo/:id', :action => 'clear_profile_photo' |