liquid_feedback_frontend

view config/example.lua @ 1235:7f818548b7b8

Added push grace period for verification phase to lf4rcs
author bsw
date Fri Dec 04 14:25:43 2015 +0100 (2015-12-04)
parents e0235b3d19ee
children 84f6e17c7ceb
line source
1 -- ========================================================================
2 -- MANDATORY (MUST BE CAREFULLY CHECKED AND PROPERLY SET!)
3 -- ========================================================================
5 -- Name of this instance, defaults to name of config file
6 -- ------------------------------------------------------------------------
7 config.instance_name = "Instance name"
10 -- Information about service provider (HTML)
11 -- ------------------------------------------------------------------------
12 config.app_service_provider = "Snake Oil<br/>10000 Berlin<br/>Germany"
15 -- A HTML formatted text the user has to accept while registering
16 -- ------------------------------------------------------------------------
17 config.use_terms = "<h1>Terms of Use</h1><p>Insert terms here</p>"
20 -- Checkbox(es) the user has to accept while registering
21 -- ------------------------------------------------------------------------
22 --[[
23 config.use_terms_checkboxes = {
24 {
25 name = "terms_of_use_v1",
26 html = "I accept the terms of use.",
27 not_accepted_error = "You have to accept the terms of use to be able to register."
28 },
29 {
30 name = "extra_terms_of_use_v1",
31 html = "I accept the extra terms of use.",
32 not_accepted_error = "You have to accept the extra terms of use to be able to register."
33 }
34 }
35 --]]
37 -- Absolute base url of application
38 -- ------------------------------------------------------------------------
39 config.absolute_base_url = "http://example.com/"
40 config.localhost = false
43 -- Connection information for the LiquidFeedback database
44 -- ------------------------------------------------------------------------
45 config.database = { engine='postgresql', dbname='liquid_feedback' }
48 -- Location of the rocketwiki binaries
49 -- ------------------------------------------------------------------------
50 config.enforce_formatting_engine = "markdown2"
51 config.formatting_engines = {
52 { id = "markdown2",
53 name = "python-markdown2",
54 executable = "markdown2",
55 args = {'-s', 'escape', '-x', 'nofollow,wiki-tables'},
56 remove_images = true
57 },
58 -- { id = "markdown_py",
59 -- name = "Python Markdown",
60 -- executable = "markdown_py",
61 -- args = {'-s', 'escape', '-x', 'extra', '-x', 'nl2br', '-x', 'sane_lists'},
62 -- remove_images = true
63 -- },
64 -- { id = "rocketwiki",
65 -- name = "RocketWiki",
66 -- executable = "/opt/rocketwiki-lqfb/rocketwiki-lqfb"
67 -- },
68 -- { id = "compat",
69 -- name = "Traditional WIKI syntax",
70 -- executable = "/opt/rocketwiki-lqfb/rocketwiki-lqfb-compat"
71 -- },
72 }
75 -- Public access level
76 -- ------------------------------------------------------------------------
77 -- Available options:
78 -- "none"
79 -- -> Closed user group, no public access at all
80 -- (except login/registration/password reset)
81 -- "anonymous"
82 -- -> Shows only initiative/suggestions texts and aggregated
83 -- supporter/voter counts
84 -- "authors_pseudonymous"
85 -- -> Like anonymous, but shows screen names of authors
86 -- "all_pseudonymous"
87 -- -> Show everything a member can see, except profile pages
88 -- "everything"
89 -- -> Show everything a member can see, including profile pages
90 -- ------------------------------------------------------------------------
91 config.public_access = "none"
95 -- ========================================================================
96 -- OPTIONAL
97 -- Remove leading -- to use a option
98 -- ========================================================================
100 -- Disable registration
101 -- ------------------------------------------------------------------------
102 -- Available options:
103 -- false: registration is enabled (default)
104 -- true: registration is disabled
105 -- ------------------------------------------------------------------------
106 -- config.disable_registration = true
109 -- List of enabled languages, defaults to available languages
110 -- ------------------------------------------------------------------------
111 -- config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu', 'it', 'ka', 'nl', 'zh-Hans', 'zh-TW' }
114 -- Default language, defaults to "en"
115 -- ------------------------------------------------------------------------
116 -- config.default_lang = "en"
119 -- after how long is a user considered inactive and the trustee will see warning,
120 -- notation is according to postgresql intervals, default: no warning at all
121 -- ------------------------------------------------------------------------
122 -- config.delegation_warning_time = '6 months'
125 -- after which time a user is advised (_soft) or forced (_hard) to check
126 -- unit and area delegations. default: no check at all
127 -- ------------------------------------------------------------------------
128 -- config.check_delegations_interval_hard = "6 months"
129 -- config.check_delegations_interval_soft = "3 months"
132 -- default option when checking delegations
133 -- available options: "confirm", "revoke" and "none", default: "confirm"
134 -- ------------------------------------------------------------------------
135 -- config.check_delegations_default = "confirm"
138 -- Prefix of all automatic mails, defaults to "[Liquid Feedback] "
139 -- ------------------------------------------------------------------------
140 -- config.mail_subject_prefix = "[LiquidFeedback] "
143 -- Sender of all automatic mails, defaults to system defaults
144 -- ------------------------------------------------------------------------
145 -- config.mail_envelope_from = "liquidfeedback@example.com"
146 -- config.mail_from = { name = "LiquidFeedback", address = "liquidfeedback@example.com" }
147 -- config.mail_reply_to = { name = "Support", address = "support@example.com" }
150 -- Configuration of password hashing algorithm (defaults to "crypt_sha512")
151 -- ------------------------------------------------------------------------
152 -- config.password_hash_algorithm = "crypt_sha512"
153 -- config.password_hash_algorithm = "crypt_sha256"
154 -- config.password_hash_algorithm = "crypt_md5"
157 -- Number of rounds for crypt_sha* algorithms, minimum and maximum
158 -- (defaults to minimum 10000 and maximum 20000)
159 -- ------------------------------------------------------------------------
160 -- config.password_hash_min_rounds = 10000
161 -- config.password_hash_max_rounds = 20000
164 -- Supply custom url for avatar/photo delivery
165 -- ------------------------------------------------------------------------
166 -- config.fastpath_url_func = nil
169 -- Local directory for database dumps offered for download
170 -- ------------------------------------------------------------------------
171 -- config.download_dir = nil
174 -- Special use terms for database dump download
175 -- ------------------------------------------------------------------------
176 -- config.download_use_terms = "=== Download use terms ===\n"
179 -- Use custom image conversion, defaults to ImageMagick's convert
180 -- ------------------------------------------------------------------------
181 --config.member_image_content_type = "image/jpeg"
182 --config.member_image_convert_func = {
183 -- avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
184 -- photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
185 --}
188 -- Display a html formatted public message of the day
189 -- ------------------------------------------------------------------------
190 -- config.motd_public = "<h1>Message of the day (public)</h1><p>The MOTD is formatted with HTML</p>"
193 -- Display a html formatted internal message of the day
194 -- ------------------------------------------------------------------------
195 -- config.motd_intern = "<h1>Message of the day (intern)</h1><p>The MOTD is formatted with HTML</p>"
198 -- Integration of Etherpad, disabled by default
199 -- ------------------------------------------------------------------------
200 --config.etherpad = {
201 -- base_url = "http://example.com:9001/",
202 -- api_base = "http://localhost:9001/",
203 -- api_key = "mysecretapikey",
204 -- group_id = "mygroupname",
205 -- cookie_path = "/"
206 --}
209 -- Free timings
210 -- ------------------------------------------------------------------------
211 -- This example expects a date string entered in the free timing field
212 -- by the user creating a poll, interpreting it as target date for then
213 -- poll and splits the remaining time at the ratio of 4:1:2
214 -- Please note, polling policies never have an admission phase
215 -- The available_func is optional, if not set any target date is allowed
217 --[[
218 config.free_timing = {
219 calculate_func = function(policy, timing_string)
220 local function interval_by_seconds(secs)
221 local secs_per_day = 60 * 60 * 24
222 local days
223 days = math.floor(secs / secs_per_day)
224 secs = secs - days * secs_per_day
225 return days .. " days " .. secs .. " seconds"
226 end
227 local target_date = parse.date(timing_string, atom.date)
228 if not target_date then
229 return false
230 end
231 local target_timestamp = target_date.midday
232 local now = atom.timestamp:get_current()
233 trace.debug(target_timestamp, now)
234 local duration = target_timestamp - now
235 if duration < 0 then
236 return false
237 end
238 return {
239 discussion = interval_by_seconds(duration / 7 * 4),
240 verification = interval_by_seconds(duration / 7 * 1),
241 voting = interval_by_seconds(duration / 7 * 2)
242 }
243 end,
244 available_func = function(policy)
245 return {
246 { name = "End of 2013", id = '2013-12-31' },
247 { name = "End of 2014", id = '2014-12-31' },
248 { name = "End of 2015", id = '2015-12-31' }
249 }
250 end
251 }
252 --]]
254 -- Configuration of lf4rcs
255 -- ------------------------------------------------------------------------
256 -- config.lf4rc = {}
258 -- Example configuration for controlling a Git repository
259 --[[
260 config.lf4rcs.git = {
262 render_draft_reference = function(url, draft)
263 if not draft.external_reference then return end
264 ui.tag{ content = _"Changeset:" }
265 slot.put(" ")
266 ui.link{
267 text = draft.external_reference,
268 external = url .. ";a=commit;h=" .. draft.external_reference
269 }
270 end,
272 get_remote_user = function()
273 return os.getenv("REMOTE_USER")
274 end,
276 get_branches = function(path, exec)
277 local branches = {}
278 for line in io.lines() do
279 local oldrev, newrev, branch = string.match(line, "([^ ]+) ([^ ]+) refs/heads/(.+)")
280 if not branch then
281 return nil, "unexpected format from git hook environment"
282 end
283 branches[branch] = { newrev }
284 end
285 return branches
286 end,
288 commit = function(path, exec, branch, target_node_id, close_message, merge_message)
289 if merge_message then
290 exec("git", "-C", path, "checkout", "-f", "master")
291 exec("git", "-C", path, "merge", target_node_id, "-m", merge_message)
292 exec("git", "-C", path, "push", "origin", "master")
293 end
294 end
296 }
298 -- Example configuration for controlling a Mercurial repository
299 config.lf4rcs.hg = {
301 working_branch_name = "work",
303 render_draft_reference = function(url, draft)
304 if not draft.external_reference then return end
305 ui.tag{ content = _"Changeset graph:" }
306 slot.put(" ")
307 ui.link{
308 text = draft.external_reference,
309 external = url .. "/graph/" .. draft.external_reference
310 }
311 end,
313 get_remote_user = function()
314 return os.getenv("REMOTE_USER")
315 end,
317 get_branches = function(path, exec)
318 local first_node_id = os.getenv("HG_NODE")
319 if not first_node_id then
320 return nil, "internal error, no first node ID available"
321 end
322 local hg_log = exec(
323 "hg", "log", "-R", path, "-r", first_node_id .. ":", "--template", "{branches}\n"
324 )
325 local branches = {}
326 for branch in hg_log:gmatch("(.-)\n") do
327 if branch == "" then branch = "default" end
328 if not branches[branch] then
329 branches[branch] = {}
330 local head_lines = exec(
331 "hg", "heads", "-R", path, "--template", "{node}\n", branch
332 )
333 for node_id in string.gmatch(head_lines, "[^\n]+") do
334 table.insert(branches[branch], node_id)
335 end
336 end
337 end
338 return branches
339 end,
341 extra_checks = function(path, exec)
342 local result = exec("hg", "heads", "-t", "-c")
343 for branch in string.gmatch(result, "[^\n]+") do
344 if branch == lf4rcs.config.hg.working_branch_name then
345 return nil, "open head found for branch " .. lf4rcs.config.hg.working_branch_name
346 end
347 end
348 return true
349 end,
351 commit = function(path, exec, branch, target_node_id, close_message, merge_message)
352 exec("hg", "up", "-R", path, "-C", "-r", target_node_id)
353 exec("hg", "commit", "-R", path, "--close-branch", "-m", close_message)
354 if merge_message then
355 exec("hg", "up", "-R", path, "-C", "-r", "default")
356 exec("hg", "merge", "-R", path, "-r", "tip")
357 exec("hg", "commit", "-R", path, "-m", merge_message)
358 end
359 end
361 }
363 -- Grace period after creating an initiative for pushing changes during verification phase
364 -- disabled by default (nil), use PostgreSQL interval notation
365 -- config.lf4rcs.push_grace_period = nil
367 lf4rcs.init()
368 --]]
370 -- External references
371 -- ------------------------------------------------------------------------
372 -- Rendering of external references
374 --[[
375 config.render_external_reference = {
376 draft = function(draft, wrapper)
377 wrapper(function()
378 ui.tag{ content = draft.external_reference)
379 end)
380 end,
381 initiative = function(initiative, wrapper)
382 wrapper(function()
383 ui.tag{ content = initiative.external_reference)
384 end)
385 end
386 end
387 --]]
389 -- Admin logger
390 -- ------------------------------------------------------------------------
391 -- Logging administrative activities
392 -- disabled by default
394 --[[
395 config.admin_logger = function(params)
397 local adminid = app.session.member_id
398 local adminname = app.session.member.name
399 local url = params._webmcp_path
401 -- do something (e.g. calling 'logger' via extos.pfilter)
403 end
404 --]]
407 -- Network interface to bind to
408 -- ------------------------------------------------------------------------
409 -- Available options:
410 -- true: bind to localhost (default)
411 -- false: bind to all interface
412 -- ------------------------------------------------------------------------
413 -- config.localhost = true
416 -- Network port to bind to
417 -- ------------------------------------------------------------------------
418 -- config.port = 8080
421 -- Serving content via IPV6
422 -- ------------------------------------------------------------------------
423 -- Available options:
424 -- nil or false: do not serve via IPv6 (default)
425 -- true: serve via IPv6
426 -- ------------------------------------------------------------------------
427 -- config.ipv6 = false
430 -- Application server fork configuration
431 -- ------------------------------------------------------------------------
432 -- config.fork = {
433 -- pre = 2, -- desired number of spare (idle) processes
434 -- min = 4, -- minimum number of processes
435 -- max = 128, -- maximum number of processes (hard limit)
436 -- delay = 0.125, -- delay (seconds) between creation of spare processes
437 -- error_delay = 2, -- delay (seconds) before retry of failed process creation
438 -- exit_delay = 2, -- delay (seconds) between destruction of excessive spare processes
439 -- idle_timeout = 900, -- idle time (seconds) after a fork gets terminated (0 for no timeout)
440 -- memory_limit = 0, -- maximum memory consumption (bytes) before process gets terminated
441 -- min_requests = 50, -- minimum count of requests handled before fork is terminated
442 -- max_requests = 100 -- maximum count of requests handled before fork is terminated
443 -- }
446 -- HTTP server options
447 -- ------------------------------------------------------------------------
448 -- http_options = {
449 -- static_headers = {} -- string or table of static headers to be returned with every request
450 -- request_header_size_limit = 1024*1024, -- maximum size of request body sent by client
451 -- request_body_size_limit = 64*1024*1024, -- maximum size of request body sent by client
452 -- idle_timeout = 65, -- maximum time until receiving the first byte of the request headera
453 -- stall_timeout = 60, -- maximum time a client connection may be stalled
454 -- request_header_timeout = 120, -- maximum time until receiving the remaining bytes of the request header
455 -- response_timeout = 3600, -- time in which request body and response must be sent
456 -- maximum_input_chunk_size = 16384 -- tweaks behavior of request-body parser
457 -- minimum_output_chunk_size = 1024 -- chunk size for chunked-transfer-encoding
458 -- }
461 -- WebMCP accelerator
462 -- ------------------------------------------------------------------------
463 -- uncomment the following line to use C implementations of chosen
464 -- functions:
465 -- ------------------------------------------------------------------------
466 -- require 'webmcp_accelerator'
469 -- Trace debug
470 -- ------------------------------------------------------------------------
471 -- uncomment the following line to enable debug trace
472 -- ------------------------------------------------------------------------
473 -- config.enable_debug_trace = true

Impressum / About Us