liquid_feedback_frontend

annotate config/example.lua @ 1221:e80c8790a1ca

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

Impressum / About Us