| rev | 
   line source | 
| 
bsw@1222
 | 
     1 config.app_version = "3.0.9"
 | 
| 
bsw@1222
 | 
     2 
 | 
| 
bsw@1222
 | 
     3 -- TODO abstraction
 | 
| 
bsw@1222
 | 
     4 -- get record by id
 | 
| 
bsw@1222
 | 
     5 function mondelefant.class_prototype:by_id(id)
 | 
| 
bsw@1222
 | 
     6   local selector = self:new_selector()
 | 
| 
bsw@1222
 | 
     7   selector:add_where{ 'id = ?', id }
 | 
| 
bsw@1222
 | 
     8   selector:optional_object_mode()
 | 
| 
bsw@1222
 | 
     9   return selector:exec()
 | 
| 
bsw@1222
 | 
    10 end
 | 
| 
bsw@1222
 | 
    11 
 | 
| 
bsw@1222
 | 
    12 if not config.password_hash_algorithm then
 | 
| 
bsw@1222
 | 
    13   config.password_hash_algorithm = "crypt_sha512"
 | 
| 
bsw@1222
 | 
    14 end
 | 
| 
bsw@1222
 | 
    15 
 | 
| 
bsw@1222
 | 
    16 if not config.password_hash_min_rounds then
 | 
| 
bsw@1222
 | 
    17  config.password_hash_min_rounds = 10000
 | 
| 
bsw@1222
 | 
    18 end
 | 
| 
bsw@1222
 | 
    19 
 | 
| 
bsw@1222
 | 
    20 if not config.password_hash_max_rounds then
 | 
| 
bsw@1222
 | 
    21   config.password_hash_max_rounds = 20000
 | 
| 
bsw@1222
 | 
    22 end
 | 
| 
bsw@1222
 | 
    23 
 | 
| 
bsw@1222
 | 
    24 if config.enabled_languages == nil then
 | 
| 
bsw@1222
 | 
    25   config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
 | 
| 
bsw@1222
 | 
    26 end
 | 
| 
bsw@1222
 | 
    27 
 | 
| 
bsw@1222
 | 
    28 if config.default_lang == nil then
 | 
| 
bsw@1222
 | 
    29   config.default_lang = "en"
 | 
| 
bsw@1222
 | 
    30 end
 | 
| 
bsw@1222
 | 
    31 
 | 
| 
bsw@1222
 | 
    32 if config.mail_subject_prefix == nil then
 | 
| 
bsw@1222
 | 
    33   config.mail_subject_prefix = "[LiquidFeedback] "
 | 
| 
bsw@1222
 | 
    34 end
 | 
| 
bsw@1222
 | 
    35 
 | 
| 
bsw@1222
 | 
    36 if config.member_image_content_type == nil then
 | 
| 
bsw@1222
 | 
    37   config.member_image_content_type = "image/jpeg"
 | 
| 
bsw@1222
 | 
    38 end
 | 
| 
bsw@1222
 | 
    39 
 | 
| 
bsw@1222
 | 
    40 if config.member_image_convert_func == nil then
 | 
| 
bsw@1222
 | 
    41   config.member_image_convert_func = {
 | 
| 
bsw@1222
 | 
    42     avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail",   "48x48", "jpeg:-") end,
 | 
| 
bsw@1222
 | 
    43     photo =  function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
 | 
| 
bsw@1222
 | 
    44   }
 | 
| 
bsw@1222
 | 
    45 end
 | 
| 
bsw@1222
 | 
    46 
 | 
| 
bsw@1222
 | 
    47 if config.locked_profile_fields == nil then
 | 
| 
bsw@1222
 | 
    48   config.locked_profile_fields = {}
 | 
| 
bsw@1222
 | 
    49 end
 | 
| 
bsw@1222
 | 
    50 
 | 
| 
bsw@1222
 | 
    51 if config.check_delegations_default == nil then
 | 
| 
bsw@1222
 | 
    52   config.check_delegations_default = "confirm"
 | 
| 
bsw@1222
 | 
    53 end
 | 
| 
bsw@1222
 | 
    54 
 | 
| 
bsw@1222
 | 
    55 if config.ldap == nil then
 | 
| 
bsw@1222
 | 
    56   config.ldap = {}
 | 
| 
bsw@1222
 | 
    57 end
 | 
| 
bsw@1222
 | 
    58 
 | 
| 
bsw@1222
 | 
    59 if not config.database then
 | 
| 
bsw@1222
 | 
    60   config.database = { engine='postgresql', dbname='liquid_feedback' }
 | 
| 
bsw@1222
 | 
    61 end
 | 
| 
bsw@1222
 | 
    62 
 | 
| 
jbe@1167
 | 
    63 if config.fork == nil then
 | 
| 
bsw@1158
 | 
    64   config.fork = {}
 | 
| 
bsw@1158
 | 
    65 end
 | 
| 
bsw@1158
 | 
    66 
 | 
| 
jbe@1167
 | 
    67 if config.fork.pre == nil then
 | 
| 
jbe@1167
 | 
    68   config.fork.pre = 2
 | 
| 
bsw@1158
 | 
    69 end
 | 
| 
bsw@1158
 | 
    70 
 | 
| 
jbe@1167
 | 
    71 if config.fork.min == nil then
 | 
| 
jbe@1167
 | 
    72   config.fork.min = 4
 | 
| 
jbe@1167
 | 
    73 end
 | 
| 
jbe@1167
 | 
    74 
 | 
| 
jbe@1167
 | 
    75 if config.fork.max == nil then
 | 
| 
bsw@1169
 | 
    76   config.fork.max = 128
 | 
| 
bsw@1158
 | 
    77 end
 | 
| 
bsw@1158
 | 
    78 
 | 
| 
jbe@1167
 | 
    79 if config.fork.delay == nil then
 | 
| 
jbe@1167
 | 
    80   config.fork.delay = 0.125
 | 
| 
jbe@1167
 | 
    81 end
 | 
| 
jbe@1167
 | 
    82 
 | 
| 
jbe@1167
 | 
    83 if config.fork.error_delay == nil then
 | 
| 
jbe@1167
 | 
    84   config.fork.error_delay = 2
 | 
| 
bsw@1158
 | 
    85 end
 | 
| 
bsw@1158
 | 
    86 
 | 
| 
jbe@1167
 | 
    87 if config.fork.exit_delay == nil then
 | 
| 
jbe@1167
 | 
    88   config.fork.exit_delay = 2
 | 
| 
jbe@1167
 | 
    89 end
 | 
| 
jbe@1167
 | 
    90 
 | 
| 
jbe@1167
 | 
    91 if config.fork.idle_timeout == nil then
 | 
| 
jbe@1167
 | 
    92   config.fork.idle_timeout = 900
 | 
| 
jbe@1167
 | 
    93 end
 | 
| 
jbe@1167
 | 
    94 
 | 
| 
jbe@1167
 | 
    95 if config.port == nil then
 | 
| 
bsw@1158
 | 
    96   config.port = 8080
 | 
| 
bsw@1158
 | 
    97 end
 | 
| 
bsw@1158
 | 
    98 
 | 
| 
bsw@1158
 | 
    99 if config.localhost == nil then
 | 
| 
bsw@1158
 | 
   100   config.localhost = true
 | 
| 
bsw@1158
 | 
   101 end
 | 
| 
bsw@1158
 | 
   102 
 | 
| 
jbe@1167
 | 
   103 local listen_options = {
 | 
| 
jbe@1167
 | 
   104   pre_fork              = config.fork.pre,
 | 
| 
jbe@1167
 | 
   105   min_fork              = config.fork.min,
 | 
| 
jbe@1167
 | 
   106   max_fork              = config.fork.max,
 | 
| 
jbe@1167
 | 
   107   fork_delay            = config.fork.delay,
 | 
| 
jbe@1167
 | 
   108   fork_error_delay      = config.fork.error_delay,
 | 
| 
jbe@1167
 | 
   109   exit_delay            = config.fork.exit_delay,
 | 
| 
jbe@1167
 | 
   110   idle_timeout          = config.fork.idle_timeout,
 | 
| 
bsw@1169
 | 
   111   memory_limit          = config.fork.memory_limit,
 | 
| 
jbe@1167
 | 
   112   min_requests_per_fork = config.fork.min_requests,
 | 
| 
jbe@1167
 | 
   113   max_requests_per_fork = config.fork.max_requests,
 | 
| 
jbe@1167
 | 
   114   http_options          = config.http_options
 | 
| 
jbe@1167
 | 
   115 }
 | 
| 
jbe@1167
 | 
   116 
 | 
| 
jbe@1167
 | 
   117 if config.ipv6 then
 | 
| 
bsw@1199
 | 
   118   local host = config.localhost and "::1" or "::"
 | 
| 
bsw@1199
 | 
   119   listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port }
 | 
| 
jbe@1167
 | 
   120 end
 | 
| 
jbe@1167
 | 
   121 if config.ipv6 ~= "only" then
 | 
| 
bsw@1202
 | 
   122   local host = config.localhost and "127.0.0.1" or "0.0.0.0"
 | 
| 
bsw@1199
 | 
   123   listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port }
 | 
| 
jbe@1167
 | 
   124 end
 | 
| 
jbe@1167
 | 
   125 
 | 
| 
bsw@1222
 | 
   126 request.set_404_route{ module = 'index', view = '404' }
 | 
| 
bsw@1222
 | 
   127 
 | 
| 
bsw@1222
 | 
   128 request.set_absolute_baseurl(config.absolute_base_url)
 | 
| 
bsw@1222
 | 
   129 
 | 
| 
jbe@1167
 | 
   130 listen(listen_options)
 | 
| 
jbe@1167
 | 
   131 
 | 
| 
bsw@1158
 | 
   132 listen{
 | 
| 
jbe@1167
 | 
   133   {
 | 
| 
jbe@1167
 | 
   134     proto = "interval",
 | 
| 
jbe@1167
 | 
   135     name  = "send_pending_notifications",
 | 
| 
jbe@1167
 | 
   136     delay = 5,
 | 
| 
jbe@1167
 | 
   137     handler = function() 
 | 
| 
jbe@1167
 | 
   138       Event:send_pending_notifications()
 | 
| 
jbe@1167
 | 
   139     end
 | 
| 
jbe@1167
 | 
   140   },
 | 
| 
jbe@1167
 | 
   141   min_fork = 1,
 | 
| 
jbe@1167
 | 
   142   max_fork = 1
 | 
| 
bsw@1158
 | 
   143 }
 | 
| 
bsw@1158
 | 
   144 
 | 
| 
bsw@1158
 | 
   145 execute.inner()
 | 
| 
bsw@1158
 | 
   146 
 |