--- layout: page title: Configuration --- # Configuring Alaveteli

You can control much of how Alaveteli looks and behaves just by changing the config settings.

## The general configuration file The alaveteli code ships with an example configuration file: `config/general.yml-example`. As part of the [installation process]({{ page.baseurl }}/docs/installing/ ), the example file gets copied to `config/general.yml`. You **must** edit this file to suit your needs. Note that the default settings for frontpage examples are designed to work with the dummy data shipped with Alaveteli. Once you have real data, you should certainly edit these. Note that there are [other configuration files](#other-config) too, for specific aspects of Alaveteli. ## Config settings by topic The following are all the configuration settings that you can change in `config/general.yml`. When you edit this file, remember it must be in the YAML syntax. It's not complicated but — especially if you're editing a list — be careful to get the indentation correct. If in doubt, look at the examples already in the file, and don't use tabs. ### Appearance and overall behaviour of the site: SITE_NAME
DOMAIN
FORCE_SSL
FORCE_REGISTRATION_ON_NEW_REQUEST
THEME_URLS
THEME_BRANCH
FRONTPAGE_PUBLICBODY_EXAMPLES
PUBLIC_BODY_STATISTICS_PAGE
MINIMUM_REQUESTS_FOR_STATISTICS
RESPONSIVE_STYLING ### Site status: READ_ONLY
STAGING_SITE ### Locale and internationalisation: ISO_COUNTRY_CODE
TIME_ZONE
AVAILABLE_LOCALES
DEFAULT_LOCALE
USE_DEFAULT_BROWSER_LANGUAGE
INCLUDE_DEFAULT_LOCALE_IN_URLS ### Definition of "late": REPLY_LATE_AFTER_DAYS
REPLY_VERY_LATE_AFTER_DAYS
SPECIAL_REPLY_VERY_LATE_AFTER_DAYS
WORKING_OR_CALENDAR_DAYS ### Admin access: ADMIN_USERNAME
ADMIN_PASSWORD
DISABLE_EMERGENCY_USER
SKIP_ADMIN_AUTH ### Email management: INCOMING_EMAIL_DOMAIN
INCOMING_EMAIL_PREFIX
INCOMING_EMAIL_SECRET
BLACKHOLE_PREFIX
CONTACT_EMAIL
CONTACT_NAME
TRACK_SENDER_EMAIL
TRACK_SENDER_NAME
RAW_EMAILS_LOCATION
EXCEPTION_NOTIFICATIONS_FROM
EXCEPTION_NOTIFICATIONS_TO
FORWARD_NONBOUNCE_RESPONSES_TO
MTA_LOG_PATH
MTA_LOG_TYPE ### General admin (keys, paths, back-end services): COOKIE_STORE_SESSION_SECRET
RECAPTCHA_PUBLIC_KEY
RECAPTCHA_PRIVATE_KEY
GAZE_URL
GA_CODE (GA=Google Analytics)
UTILITY_SEARCH_PATH
SHARED_FILES_PATH
SHARED_FILES
SHARED_DIRECTORIES ### Behaviour settings and switches: NEW_RESPONSE_REMINDER_AFTER_DAYS
AUTHORITY_MUST_RESPOND
MAX_REQUESTS_PER_USER_PER_DAY
OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS
ALLOW_BATCH_REQUESTS
PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE ### External public services: BLOG_FEED
TWITTER_USERNAME
TWITTER_WIDGET_ID
DONATION_URL ### Development work or special cases: DEBUG_RECORD_MEMORY
VARNISH_HOST
USE_MAILCATCHER_IN_DEVELOPMENT
USE_GHOSTSCRIPT_COMPRESSION
HTML_TO_PDF_COMMAND
CACHE_FRAGMENTS --- ## All the general settings
SITE_NAME
SITE_NAME appears in various places throughout the site.

Examples:

  • SITE_NAME: 'Alaveteli'
  • SITE_NAME: 'WhatDoTheyKnow'
DOMAIN
Domain used in URLs generated by scripts (e.g. for going in some emails)

Examples:

  • DOMAIN: '127.0.0.1:3000'
  • DOMAIN: 'www.example.com'
FORCE_SSL
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.

Example:

  • FORCE_SSL: true
FORCE_REGISTRATION_ON_NEW_REQUEST
Does a user needs to sign in to start the New Request process?

Example:

  • FORCE_REGISTRATION_ON_NEW_REQUEST: false
THEME_URLS
URLs of themes to download and use (when running the rails-post-deploy script). The earlier in the list means the templates have a higher priority.

Example:

  • THEME_URLS:
     - 'git://github.com/mysociety/alavetelitheme.git'
    
THEME_BRANCH
When rails-post-deploy installs the themes, it will try the theme branch first, but only if you've set THEME_BRANCH to be true. If the branch doesn't exist it will fall back to using a tagged version specific to your installed alaveteli version, and if that doesn't exist it will back to master.

The default theme is the "Alaveteli" theme. This gets installed automatically when rails-post-deploy runs.

Example:

  • THEME_BRANCH: false
FRONTPAGE_PUBLICBODY_EXAMPLES
Specify which public bodies you want to be listed as examples on the home page, using their short_names. If you want more than one, separate them with semicolons. Comment this out if you want this to be auto-generated.

Warning: this is slow — don't use in production!

Examples:

  • FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
  • FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq;foo;bar'
  • # FRONTPAGE_PUBLICBODY_EXAMPLES:
PUBLIC_BODY_STATISTICS_PAGE & MINIMUM_REQUESTS_FOR_STATISTICS
If PUBLIC_BODY_STATISTICS_PAGE is set to true, Alaveteli will make a page of statistics on the performance of public bodies (which you can see at /body_statistics). The page will only consider public bodies that have had at least the number of requests set by MINIMUM_REQUESTS_FOR_STATISTICS.

Example:

  • PUBLIC_BODY_STATISTICS_PAGE: false
  • MINIMUM_REQUESTS_FOR_STATISTICS: 50
RESPONSIVE_STYLING
Use the responsive base stylesheets and templates, rather than those that only render the site at a fixed width. These stylesheets are currently experimental but will become the default in the future. They allow the site to render nicely on mobile devices as well as larger screens. Currently the fixed width stylesheets are used by default.

Example:

  • RESPONSIVE_STYLING: true
READ_ONLY
If present, READ_ONLY 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.

Examples:

  • Typically, you do not want to run your site in read-only mode — so set READ_ONLY to be an empty string.
    READ_ONLY: ''
  • READ_ONLY: 'The site is not currently accepting requests while we move the server.'
STAGING_SITE
Is this a staging or development site? If not, it's a live production site. This setting controls whether or not the rails-post-deploy script will create the file config/rails_env.rb file to force Rails into production environment.

Examples:

  • For staging or development:

    STAGING_SITE: 1

  • For production:

    STAGING_SITE: 0

ISO_COUNTRY_CODE
The ISO country code of the country in which your Alaveteli site is deployed.

Example:

  • ISO_COUNTRY_CODE: GB
TIME_ZONE
This is the timezone that Alaveteli usese to display times and dates. If not set, defaults to UTC.

Example:

  • TIME_ZONE: Australia/Sydney
AVAILABLE_LOCALES & DEFAULT_LOCALE
AVAILABLE_LOCALES lists all the locales you want your site to support. If there is more than one, use spaces betwween the entries. Nominate one of these locales as the default with DEFAULT_LOCALE.

Examples:

  • AVAILABLE_LOCALES: 'en es'
  • DEFAULT_LOCALE: 'en'
USE_DEFAULT_BROWSER_LANGUAGE
Should Alaveteli try to use the default language of the user's browser?

Example:

  • USE_DEFAULT_BROWSER_LANGUAGE: true
INCLUDE_DEFAULT_LOCALE_IN_URLS
Normally, Alaveteli will put the locale into its URLs, like this www.example.com/en/body/list/all. If you don't want this behaviour whenever the locale is the default one, set INCLUDE_DEFAULT_LOCALE_IN_URLS to false.

Example:

  • INCLUDE_DEFAULT_LOCALE_IN_URLS: true
REPLY_LATE_AFTER_DAYS
REPLY_VERY_LATE_AFTER_DAYS
SPECIAL_REPLY_VERY_LATE_AFTER_DAYS WORKING_OR_CALENDAR_DAYS
The REPLY...AFTER_DAYS settings define how many days must have passed before an answer to a request is officially late. The SPECIAL case is for some types of authority (for example: in the UK, schools) which are granted a bit longer than everyone else to respond to questions. The WORKING_OR_CALENDAR_DAYS setting can be either "working" (the default) or "calendar", and determines which days are counted.

Examples:

  • REPLY_LATE_AFTER_DAYS: 20
  • REPLY_VERY_LATE_AFTER_DAYS: 40
  • SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
  • WORKING_OR_CALENDAR_DAYS: working
ADMIN_USERNAME & ADMIN_PASSWORD
DISABLE_EMERGENCY_USER
Details for the emergency user.

This is useful for creating the initial admin users for your site:

For details of this process, see creating a superuser account.

Examples:

  • ADMIN_USERNAME: 'adminxxxx'
  • ADMIN_PASSWORD: 'passwordx'
  • DISABLE_EMERGENCY_USER: false
SKIP_ADMIN_AUTH
Set this to true, and the admin interface will be available to anonymous users. Obviously, you should not set this to be true in production environments.

Example:

  • SKIP_ADMIN_AUTH: false
INCOMING_EMAIL_DOMAIN
Your email domain for incoming mail. See also How Alaveteli handles email.

Example:

  • INCOMING_EMAIL_DOMAIN: 'localhost'
  • INCOMING_EMAIL_DOMAIN: 'foifa.com'
INCOMING_EMAIL_PREFIX
An optional prefix to help you distinguish FOI requests. See also How Alaveteli handles email.

Example:

  • INCOMING_EMAIL_PREFIX: ''
  • INCOMING_EMAIL_PREFIX: 'foi+'
INCOMING_EMAIL_SECRET
Used for hash in request email address.

Example:

  • INCOMING_EMAIL_SECRET: '11ae 4e3b 70ff c001 3682 4a51 e86d ef5f'
BLACKHOLE_PREFIX
Used as envelope from at the incoming email domain for cases where you don't care about failure.

Example:

  • BLACKHOLE_PREFIX: 'do-not-reply-to-this-address'
CONTACT_EMAIL & CONTACT_NAME
Email "from" details. See also How Alaveteli handles email.

Examples:

  • CONTACT_EMAIL: 'team@example.com'
  • CONTACT_NAME: 'Alaveteli Webmaster'
TRACK_SENDER_EMAIL & TRACK_SENDER_NAME
Email "from" details for track messages. See also How Alaveteli handles email.

Examples:

  • TRACK_SENDER_EMAIL: 'alaveteli@example.com'
  • TRACK_SENDER_NAME: 'Alaveteli Webmaster'
RAW_EMAILS_LOCATION
Where the raw incoming email data gets stored. Make sure you back this up!

Example:

  • RAW_EMAILS_LOCATION: 'files/raw_emails'
EXCEPTION_NOTIFICATIONS_FROM & EXCEPTION_NOTIFICATIONS_TO
Email address(es) used for sending exception notifications.

Examples:

  • EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com
    
    EXCEPTION_NOTIFICATIONS_TO:
     - robin@example.com
     - seb@example.com
    
FORWARD_NONBOUNCE_RESPONSES_TO
The email address to which non-bounce responses should be forwarded. See also How Alaveteli handles email.

Example:

  • FORWARD_NONBOUNCE_RESPONSES_TO: user-support@example.com
MTA_LOG_PATH
Path to your exim or postfix log files that will get sucked up by script/load-mail-server-logs.

Example:

  • MTA_LOG_PATH: '/var/log/exim4/exim-mainlog-*'
MTA_LOG_TYPE
Are you using "exim" or "postfix" for your Mail Transfer Agnt (MTA)?

Example:

  • MTA_LOG_TYPE: "exim"
COOKIE_STORE_SESSION_SECRET
Secret key for signing cookie_store sessions. Make it long and random.

Example:

  • COOKIE_STORE_SESSION_SECRET: 'uIngVC238Jn9NsaQizMNf89pliYmDBFugPjHS2JJmzOp8'
RECAPTCHA_PUBLIC_KEY & RECAPTCHA_PRIVATE_KEY
Recaptcha, for detecting humans. Get keys here: http://recaptcha.net/whyrecaptcha.html

Examples:

  • RECAPTCHA_PUBLIC_KEY: '7HoPjGBBBBBBBBBkmj78HF9PjjaisQ893'
  • RECAPTCHA_PRIVATE_KEY: '7HjPjGBBBBBCBBBpuTy8a33sgnGG7A'
GAZE_URL
Alateveli uses mySociety's gazeteer service to determine country from incoming IP address (this lets us suggest an Alaveteli in their country, if one exists). You shouldn't normally need to change this.

Example:

  • GAZE_URL: http://gaze.mysociety.org
GA_CODE (GA=Google Analytics)
Adding a value here will enable Google Analytics on all non-admin pages for non-admin users.

Examples:

  • GA_CODE: ''
  • GA_CODE: 'AB-8222142-14'
UTILITY_SEARCH_PATH
Search path for external command-line utilities (such as pdftohtml, pdftk, unrtf).

Example:

  • UTILITY_SEARCH_PATH: ["/usr/bin", "/usr/local/bin"]
SHARED_FILES_PATH
In some deployments of Alaveteli you may wish to install each newly deployed version alongside the previous ones, in which case certain files and resources should be shared between these installations. For example, the files directory, the cache directory and the generated graphs such as public/foi-live-creation.png. If you're installing Alaveteli in such a setup then set SHARED_FILES_PATH to the directory you're keeping these files under. Otherwise, leave it blank.

Example:

  • SHARED_FILES_PATH: ''
SHARED_FILES & SHARED_DIRECTORIES
If you have SHARED_FILES_PATH set, then these options list the files and directories that are shared; i.e. those to which the deploy scripts should create symlinks from the repository.

Examples:

  • SHARED_FILES:
     - config/database.yml
     - config/general.yml
     - config/rails_env.rb
     - config/newrelic.yml
     - config/httpd.conf
     - public/foi-live-creation.png
     - public/foi-user-use.png
     - config/aliases
                
  • SHARED_DIRECTORIES:
     - files/
     - cache/
     - lib/acts_as_xapian/xapiandbs/
     - vendor/bundle
     - public/assets
                
NEW_RESPONSE_REMINDER_AFTER_DAYS
Number of days after which to send a 'new response reminder'.

Example:

  • NEW_RESPONSE_REMINDER_AFTER_DAYS: [3, 10, 24]
AUTHORITY_MUST_RESPOND
Introduced in Alaveteli version 0.21
Set this to true if authorities must respond by law. Set to false otherwise. It defaults to true. At the moment this just controls the display of some UI text telling users that the authority must respond to them by law.

Example:

  • AUTHORITY_MUST_RESPOND: true
MAX_REQUESTS_PER_USER_PER_DAY
This rate limiting can be turned off per-user via the admin interface.

Example:

  • MAX_REQUESTS_PER_USER_PER_DAY: 6
OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS
If you want to override all the public body request emails with your own email address so that request emails that would normally go to the public body go to you, use this setting. This is useful for a staging server, so you can play with the whole process of sending requests without inadvertently sending an email to a real authority.

Examples:

  • OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS: test-email@foo.com
  • If you don't want this behaviour, comment the setting out
    # OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS:
ALLOW_BATCH_REQUESTS
Allow some users to make batch requests to multiple authorities. Once this is set to true, you can enable batch requests for an individual user via the user admin page.

Example:

  • ALLOW_BATCH_REQUESTS: false
PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE
If you would like the public body list page to include bodies that have no translation in the current locale (but which do have a translation in the default locale), set this to true.

Example:

  • PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE: false
BLOG_FEED
These feeds are displayed accordingly on the Alaveteli "blog" page:

Example:

  • BLOG_FEED: 'https://www.mysociety.org/category/projects/whatdotheyknow/feed/'
TWITTER_USERNAME TWITTER_WIDGET_ID
If you want a twitter feed displayed on the "blog" page, provide the widget ID and username.

Examples:

  • TWITTER_USERNAME: WhatDoTheyKnow
  • TWITTER_WIDGET_ID: '833549204689320031'
DONATION_URL
URL where people can donate to the organisation running the site. If set, this will be included in the message people see when their request is successful.

Example:

  • DONATION_URL: "https://www.mysociety.org/donate/"
DEBUG_RECORD_MEMORY
For debugging memory problems. If true, Alaveteli 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.

Example:

  • DEBUG_RECORD_MEMORY: false
VARNISH_HOST
If you're running behind Varnish, it might help to set this to work out where to send purge requests. Otherwise, don't set it.

Examples:

  • VARNISH_HOST: null
  • VARNISH_HOST: localhost
USE_MAILCATCHER_IN_DEVELOPMENT
If true, while in development mode, try to send mail by SMTP to port 1025 (the port the mailcatcher listens on by default):

Example:

  • USE_MAILCATCHER_IN_DEVELOPMENT: true
USE_GHOSTSCRIPT_COMPRESSION
Currently we default to using pdftk to compress PDFs. You can optionally try Ghostscript, which should do a better job of compression. Some versions of pdftk are buggy with respect to compression, in which case Alaveteli doesn't recompress the PDFs at all and logs a warning message "Unable to compress PDF" — which would be another reason to try this setting.

Example:

  • USE_GHOSTSCRIPT_COMPRESSION: true
HTML_TO_PDF_COMMAND
Path to a program that converts an HTML page in a file to PDF. It should take two arguments: the URL, and a path to an output file. A static binary of wkhtmltopdf is recommended. If the command is not present, a text-only version will be rendered instead.

Example:

  • HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
CACHE_FRAGMENTS
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

Example:

  • CACHE_FRAGMENTS: true
## Other configuration files Note that there are other configuration files for Alaveteli — you'll find them all in the `config` directory. These are presented in the git repository as `*-example` files which you can copy into place.
database.yml
database settings (as per Rails)
deploy.yml
deployment specifications used by Capistrano
httpd.conf, nginx.conf
Apache and Nginx configuration suggestions
newrelic.yml
Analytics configuration