aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/environment.rb17
-rw-r--r--config/general.yml118
-rw-r--r--config/initializers/fast_gettext.rb2
-rw-r--r--config/routes.rb2
-rw-r--r--config/test.yml118
5 files changed, 246 insertions, 11 deletions
diff --git a/config/environment.rb b/config/environment.rb
index 91839c043..d15ee9a0e 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -37,7 +37,11 @@ require File.join(File.dirname(__FILE__), '../lib/old_rubygems_patch')
Rails::Initializer.run do |config|
# Load intial mySociety config
- MySociety::Config.set_file(File.join(config.root_path, 'config', 'general'), true)
+ if ENV["RAILS_ENV"] == "test"
+ MySociety::Config.set_file(File.join(config.root_path, 'config', 'test'), true)
+ else
+ MySociety::Config.set_file(File.join(config.root_path, 'config', 'general'), true)
+ end
MySociety::Config.load_default
# Settings in config/environments/* take precedence over those specified here
@@ -119,14 +123,8 @@ if (MySociety::Config.get("DOMAIN", "") != "")
end
# fallback locale and available locales
-if ENV["RAILS_ENV"] == "test"
- # The tests assume that the "en" and "es" locales are available
- available_locales = ["en", "es"]
- default_locale = "en"
-else
- available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'en es').split(/ /)
- default_locale = MySociety::Config.get('DEFAULT_LOCALE', 'en')
-end
+available_locales = MySociety::Config.get('AVAILABLE_LOCALES', '').split(/ /)
+default_locale = MySociety::Config.get('DEFAULT_LOCALE', '')
FastGettext.default_available_locales = available_locales
I18n.locale = default_locale
@@ -134,6 +132,7 @@ 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/
+require 'ruby19.rb'
require 'tmail_extensions.rb'
require 'activesupport_cache_extensions.rb'
require 'timezone_fixes.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/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb
index 026c4111c..63cf6b50d 100644
--- a/config/initializers/fast_gettext.rb
+++ b/config/initializers/fast_gettext.rb
@@ -1,2 +1,2 @@
-FastGettext.add_text_domain 'app', :path => 'locale', :type => :po
+FastGettext.add_text_domain 'app', :path => File.join(Rails.root, 'locale'), :type => :po
FastGettext.default_text_domain = 'app'
diff --git a/config/routes.rb b/config/routes.rb
index 48bf92e75..511b5fc1e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -15,7 +15,7 @@ ActionController::Routing::Routes.draw do |map|
# 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'
+ require File.join(Rails.root, 'config', 'custom-routes')
map.with_options :controller => 'general' do |general|
general.frontpage '/', :action => 'frontpage'
diff --git a/config/test.yml b/config/test.yml
new file mode 100644
index 000000000..c13b9c9db
--- /dev/null
+++ b/config/test.yml
@@ -0,0 +1,118 @@
+# test.yml
+# Test values for the "general" config file.
+#
+# Configuration parameters, in YAML syntax.
+#
+# These may be values expected by the test suite; changing them may
+# break tests.
+
+# 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 es'
+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: 'xxx'
+RECAPTCHA_PRIVATE_KEY: 'xxx'
+
+# 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