forked from mysociety/alaveteli
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfiguration.rb
98 lines (94 loc) · 3.76 KB
/
configuration.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Configuration values with defaults
# TODO: Make this return different values depending on the current rails environment
module AlaveteliConfiguration
mattr_accessor :config
if !const_defined?(:DEFAULTS)
DEFAULTS = {
:ADMIN_PASSWORD => '',
:ADMIN_USERNAME => '',
:ALLOW_BATCH_REQUESTS => false,
:AUTHORITY_MUST_RESPOND => true,
:AVAILABLE_LOCALES => '',
:BLACKHOLE_PREFIX => 'do-not-reply-to-this-address',
:BLOG_FEED => '',
:BLOG_TIMEOUT => 60,
:CACHE_FRAGMENTS => true,
:CONTACT_EMAIL => 'contact@localhost',
:CONTACT_NAME => 'Alaveteli',
:COOKIE_STORE_SESSION_SECRET => 'this default is insecure as code is open source, please override for live sites in config/general; this will do for local development',
:DEBUG_RECORD_MEMORY => false,
:DEFAULT_LOCALE => '',
:DISABLE_EMERGENCY_USER => false,
:DOMAIN => 'localhost:3000',
:DONATION_URL => '',
:ENABLE_ANNOTATIONS => true,
:ENABLE_TWO_FACTOR_AUTH => false,
:ENABLE_WIDGETS => false,
:EXCEPTION_NOTIFICATIONS_FROM => 'errors@localhost',
:EXCEPTION_NOTIFICATIONS_TO => 'user-support@localhost',
:FORCE_REGISTRATION_ON_NEW_REQUEST => false,
:FORCE_SSL => true,
:FORWARD_NONBOUNCE_RESPONSES_TO => 'user-support@localhost',
:FRONTPAGE_PUBLICBODY_EXAMPLES => '',
:GA_CODE => '',
:GAZE_URL => '',
:GEOIP_DATABASE => '/usr/share/GeoIP/GeoIP.dat',
:HTML_TO_PDF_COMMAND => '',
:INCLUDE_DEFAULT_LOCALE_IN_URLS => true,
:INCOMING_EMAIL_DOMAIN => 'localhost',
:INCOMING_EMAIL_PREFIX => 'foi+',
:INCOMING_EMAIL_SECRET => 'dummysecret',
:ISO_COUNTRY_CODE => 'GB',
:MINIMUM_REQUESTS_FOR_STATISTICS => 100,
:MAX_REQUESTS_PER_USER_PER_DAY => 6,
:MTA_LOG_PATH => '/var/log/exim4/exim-mainlog-*',
:MTA_LOG_TYPE => 'exim',
:NEW_RESPONSE_REMINDER_AFTER_DAYS => [3, 10, 24],
:OVERRIDE_ALL_PUBLIC_BODY_REQUEST_EMAILS => '',
:PRODUCTION_MAILER_DELIVERY_METHOD => 'sendmail',
:PUBLIC_BODY_STATISTICS_PAGE => false,
:PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE => false,
:RAW_EMAILS_LOCATION => 'files/raw_emails',
:READ_ONLY => '',
:RECAPTCHA_PRIVATE_KEY => 'x',
:RECAPTCHA_PUBLIC_KEY => 'x',
:REPLY_LATE_AFTER_DAYS => 20,
:REPLY_VERY_LATE_AFTER_DAYS => 40,
:RESPONSIVE_STYLING => true,
:SITE_NAME => 'Alaveteli',
:SKIP_ADMIN_AUTH => false,
:SMTP_MAILER_ADDRESS => 'localhost',
:SMTP_MAILER_PORT => 25,
:SMTP_MAILER_DOMAIN => '',
:SMTP_MAILER_USER_NAME => '',
:SMTP_MAILER_PASSWORD => '',
:SMTP_MAILER_AUTHENTICATION => 'plain',
:SMTP_MAILER_ENABLE_STARTTLS_AUTO => true,
:RESTRICT_NEW_RESPONSES_ON_OLD_REQUESTS_AFTER_MONTHS => 6,
:THEME_BRANCH => false,
:THEME_URL => "",
:THEME_URLS => [],
:TIME_ZONE => "UTC",
:TRACK_SENDER_EMAIL => 'contact@localhost',
:TRACK_SENDER_NAME => 'Alaveteli',
:TWITTER_USERNAME => '',
:TWITTER_WIDGET_ID => false,
:USE_DEFAULT_BROWSER_LANGUAGE => true,
:USE_GHOSTSCRIPT_COMPRESSION => false,
:USE_MAILCATCHER_IN_DEVELOPMENT => true,
:USE_RECAPTCHA_FOR_REGISTRATION => false,
:UTILITY_SEARCH_PATH => ["/usr/bin", "/usr/local/bin"],
:VARNISH_HOST => '',
:WORKING_OR_CALENDAR_DAYS => 'working',
:USE_BULLET_IN_DEVELOPMENT => false,
:INCOMING_EMAIL_SPAM_ACTION => false,
:EXTERNAL_REVIEWERS => ''
}
end
def self.method_missing(name)
self.config ||= YAML.load(ERB.new(File.read(Rails.root.join 'config', 'general.yml')).result)
key = name.to_s.upcase
return super unless self.config.has_key?(key) or DEFAULTS.has_key?(key.to_sym)
config.fetch(key, DEFAULTS[key.to_sym])
end
end