liquid_feedback_frontend

view config/example.lua @ 1579:c6883a7dce61

Setting cookie to fix login API
author bsw
date Mon Dec 14 18:06:06 2020 +0100 (2020-12-14)
parents 32cc544d5a5b
children 3fb752f4afcb
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 = "authors_pseudonymous"
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 -- Template for digest emails
151 -- #{name} will be replaced by member screen name
152 -- #{digest} will be replaced with the digest content
153 -- ------------------------------------------------------------------------
154 -- config.notification_digest_template = [[
155 -- Hello #{name},
156 --
157 -- this is your personal digest.
158 --
159 -- #{digest}
160 -- ]]
163 -- Configuration of password hashing algorithm (defaults to "crypt_sha512")
164 -- ------------------------------------------------------------------------
165 -- config.password_hash_algorithm = "crypt_sha512"
166 -- config.password_hash_algorithm = "crypt_sha256"
167 -- config.password_hash_algorithm = "crypt_md5"
170 -- Number of rounds for crypt_sha* algorithms, minimum and maximum
171 -- (defaults to minimum 10000 and maximum 20000)
172 -- ------------------------------------------------------------------------
173 -- config.password_hash_min_rounds = 10000
174 -- config.password_hash_max_rounds = 20000
177 -- Supply custom url for avatar/photo delivery
178 -- ------------------------------------------------------------------------
179 -- config.fastpath_url_func = nil
182 -- Local directory for database dumps offered for download
183 -- ------------------------------------------------------------------------
184 -- config.download_dir = nil
187 -- Special use terms for database dump download
188 -- ------------------------------------------------------------------------
189 -- config.download_use_terms = "=== Download use terms ===\n"
192 -- Use custom image conversion, defaults to ImageMagick's convert
193 -- ------------------------------------------------------------------------
194 --config.member_image_content_type = "image/jpeg"
195 --config.member_image_convert_func = {
196 -- avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
197 -- photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
198 --}
201 -- Display a html formatted public message of the day
202 -- ------------------------------------------------------------------------
203 -- config.motd_public = "<h1>Message of the day (public)</h1><p>The MOTD is formatted with HTML</p>"
206 -- Display a html formatted internal message of the day
207 -- ------------------------------------------------------------------------
208 -- config.motd_intern = "<h1>Message of the day (intern)</h1><p>The MOTD is formatted with HTML</p>"
211 -- Integration of Etherpad, disabled by default
212 -- ------------------------------------------------------------------------
213 --config.etherpad = {
214 -- base_url = "http://example.com:9001/",
215 -- api_base = "http://localhost:9001/",
216 -- api_key = "mysecretapikey",
217 -- group_id = "mygroupname",
218 -- cookie_path = "/"
219 --}
222 -- Free timings
223 -- ------------------------------------------------------------------------
224 -- This example expects a date string entered in the free timing field
225 -- by the user creating a poll, interpreting it as target date for then
226 -- poll and splits the remaining time at the ratio of 4:1:2
227 -- Please note, polling policies never have an admission phase
228 -- The available_func is optional, if not set any target date is allowed
230 --[[
231 config.free_timing = {
232 calculate_func = function(policy, timing_string)
233 local function interval_by_seconds(secs)
234 local secs_per_day = 60 * 60 * 24
235 local days
236 days = math.floor(secs / secs_per_day)
237 secs = secs - days * secs_per_day
238 return days .. " days " .. secs .. " seconds"
239 end
240 local target_date = parse.date(timing_string, atom.date)
241 if not target_date then
242 return false
243 end
244 local target_timestamp = target_date.midday
245 local now = atom.timestamp:get_current()
246 trace.debug(target_timestamp, now)
247 local duration = target_timestamp - now
248 if duration < 0 then
249 return false
250 end
251 return {
252 discussion = interval_by_seconds(duration / 7 * 4),
253 verification = interval_by_seconds(duration / 7 * 1),
254 voting = interval_by_seconds(duration / 7 * 2)
255 }
256 end,
257 available_func = function(policy)
258 return {
259 { name = "End of 2013", id = '2013-12-31' },
260 { name = "End of 2014", id = '2014-12-31' },
261 { name = "End of 2015", id = '2015-12-31' }
262 }
263 end
264 }
265 --]]
267 -- Configuration of lf4rcs
268 -- ------------------------------------------------------------------------
269 -- config.lf4rc = {}
271 -- Example configuration for controlling a Git repository
272 --[[
273 config.lf4rcs.git = {
275 render_draft_reference = function(url, draft)
276 if not draft.external_reference then return end
277 ui.tag{ content = _"Changeset:" }
278 slot.put(" ")
279 ui.link{
280 text = draft.external_reference,
281 external = url .. ";a=commit;h=" .. draft.external_reference
282 }
283 end,
285 get_remote_user = function()
286 return os.getenv("REMOTE_USER")
287 end,
289 get_branches = function(path, exec)
290 local branches = {}
291 for line in io.lines() do
292 local oldrev, newrev, branch = string.match(line, "([^ ]+) ([^ ]+) refs/heads/(.+)")
293 if not branch then
294 return nil, "unexpected format from git hook environment"
295 end
296 branches[branch] = { newrev }
297 end
298 return branches
299 end,
301 commit = function(path, exec, branch, target_node_id, close_message, merge_message)
302 if merge_message then
303 exec("git", "-C", path, "checkout", "-f", "master")
304 exec("git", "-C", path, "merge", target_node_id, "-m", merge_message)
305 exec("git", "-C", path, "push", "origin", "master")
306 end
307 end
309 }
311 -- Example configuration for controlling a Mercurial repository
312 config.lf4rcs.hg = {
314 working_branch_name = "work",
316 render_draft_reference = function(url, draft)
317 if not draft.external_reference then return end
318 ui.tag{ content = _"Changeset graph:" }
319 slot.put(" ")
320 ui.link{
321 text = draft.external_reference,
322 external = url .. "/graph/" .. draft.external_reference
323 }
324 end,
326 get_remote_user = function()
327 return os.getenv("REMOTE_USER")
328 end,
330 get_branches = function(path, exec)
331 local first_node_id = os.getenv("HG_NODE")
332 if not first_node_id then
333 return nil, "internal error, no first node ID available"
334 end
335 local hg_log = exec(
336 "hg", "log", "-R", path, "-r", first_node_id .. ":", "--template", "{branches}\n"
337 )
338 local branches = {}
339 for branch in hg_log:gmatch("(.-)\n") do
340 if branch == "" then branch = "default" end
341 if not branches[branch] then
342 branches[branch] = {}
343 local head_lines = exec(
344 "hg", "heads", "-R", path, "--template", "{node}\n", branch
345 )
346 for node_id in string.gmatch(head_lines, "[^\n]+") do
347 table.insert(branches[branch], node_id)
348 end
349 end
350 end
351 return branches
352 end,
354 extra_checks = function(path, exec)
355 local result = exec("hg", "heads", "-t", "-c")
356 for branch in string.gmatch(result, "[^\n]+") do
357 if branch == lf4rcs.config.hg.working_branch_name then
358 return nil, "open head found for branch " .. lf4rcs.config.hg.working_branch_name
359 end
360 end
361 return true
362 end,
364 commit = function(path, exec, branch, target_node_id, close_message, merge_message)
365 exec("hg", "up", "-R", path, "-C", "-r", target_node_id)
366 exec("hg", "commit", "-R", path, "--close-branch", "-m", close_message)
367 if merge_message then
368 exec("hg", "up", "-R", path, "-C", "-r", "default")
369 exec("hg", "merge", "-R", path, "-r", "tip")
370 exec("hg", "commit", "-R", path, "-m", merge_message)
371 end
372 end
374 }
376 -- Grace period after creating an initiative for pushing changes during verification phase
377 -- disabled by default (nil), use PostgreSQL interval notation
378 -- config.lf4rcs.push_grace_period = nil
380 lf4rcs.init()
381 --]]
383 -- External references
384 -- ------------------------------------------------------------------------
385 -- Rendering of external references
387 --[[
388 config.render_external_reference = {
389 draft = function(draft, wrapper)
390 wrapper(function()
391 ui.tag{ content = draft.external_reference)
392 end)
393 end,
394 initiative = function(initiative, wrapper)
395 wrapper(function()
396 ui.tag{ content = initiative.external_reference)
397 end)
398 end
399 end
400 --]]
402 -- Admin logger
403 -- ------------------------------------------------------------------------
404 -- Logging administrative activities
405 -- disabled by default
407 --[[
408 config.admin_logger = function(params)
410 local adminid = app.session.member_id
411 local adminname = app.session.member.name
412 local url = params._webmcp_path
414 -- do something (e.g. calling 'logger' via extos.pfilter)
416 end
417 --]]
420 -- Network interface to bind to
421 -- ------------------------------------------------------------------------
422 -- Available options:
423 -- true: bind to localhost (default)
424 -- false: bind to all interface
425 -- ------------------------------------------------------------------------
426 -- config.localhost = true
429 -- Network port to bind to
430 -- ------------------------------------------------------------------------
431 -- config.port = 8080
434 -- Serving content via IPV6
435 -- ------------------------------------------------------------------------
436 -- Available options:
437 -- nil or false: do not serve via IPv6 (default)
438 -- true: serve via IPv6
439 -- ------------------------------------------------------------------------
440 -- config.ipv6 = false
443 -- Application server fork configuration
444 -- ------------------------------------------------------------------------
445 -- config.fork = {
446 -- pre = 2, -- desired number of spare (idle) processes
447 -- min = 4, -- minimum number of processes
448 -- max = 128, -- maximum number of processes (hard limit)
449 -- delay = 0.125, -- delay (seconds) between creation of spare processes
450 -- error_delay = 2, -- delay (seconds) before retry of failed process creation
451 -- exit_delay = 2, -- delay (seconds) between destruction of excessive spare processes
452 -- idle_timeout = 900, -- idle time (seconds) after a fork gets terminated (0 for no timeout)
453 -- memory_limit = 0, -- maximum memory consumption (bytes) before process gets terminated
454 -- min_requests = 50, -- minimum count of requests handled before fork is terminated
455 -- max_requests = 100 -- maximum count of requests handled before fork is terminated
456 -- }
459 -- HTTP server options
460 -- ------------------------------------------------------------------------
461 -- http_options = {
462 -- static_headers = {} -- string or table of static headers to be returned with every request
463 -- request_header_size_limit = 1024*1024, -- maximum size of request body sent by client
464 -- request_body_size_limit = 64*1024*1024, -- maximum size of request body sent by client
465 -- idle_timeout = 65, -- maximum time until receiving the first byte of the request headera
466 -- stall_timeout = 60, -- maximum time a client connection may be stalled
467 -- request_header_timeout = 120, -- maximum time until receiving the remaining bytes of the request header
468 -- response_timeout = 3600, -- time in which request body and response must be sent
469 -- maximum_input_chunk_size = 16384 -- tweaks behavior of request-body parser
470 -- minimum_output_chunk_size = 1024 -- chunk size for chunked-transfer-encoding
471 -- }
474 -- WebMCP accelerator
475 -- ------------------------------------------------------------------------
476 -- uncomment the following line to use C implementations of chosen
477 -- functions:
478 -- ------------------------------------------------------------------------
479 -- require 'webmcp_accelerator'
482 -- Trace debug
483 -- ------------------------------------------------------------------------
484 -- uncomment the following line to enable debug trace
485 -- ------------------------------------------------------------------------
486 config.enable_debug_trace = true
489 config.fork = {
490 pre =1, min = 1, max = 1, max_requests = 1, min_requests = 1
491 }
493 config.localhost = true
495 config.oauth2 = {
496 available_scopes = {
497 { scope = "read", name = { de = "Lesen", en = "Read data" } },
498 { scope = "write", name = { de = "Schreiben", en = "Write data" } },
499 { scope = "privA", name = { de = "Beispielprivileg A", en = "Example privilege A" } },
500 { scope = "privB", name = { de = "Beispielprivileg B", en = "Example privilege B" } }
501 },
502 authorization_code_lifetime = 5 * 60,
503 refresh_token_lifetime = 60 * 60 * 24 * 30 * 3,
504 refresh_pause = 60,
505 refresh_grace_period = 60,
506 access_token_lifetime = 60 * 60,
507 -- NOTE for init.lua : check for refresh_pause >= refresh_grace_period
508 endpoint_magic = "liquidfeedback_client_redirection_endpoint"
509 }

Impressum / About Us