bsw@1237: config.app_version = "3.1.0" bsw@1222: bsw@1222: -- TODO abstraction bsw@1222: -- get record by id bsw@1222: function mondelefant.class_prototype:by_id(id) bsw@1222: local selector = self:new_selector() bsw@1222: selector:add_where{ 'id = ?', id } bsw@1222: selector:optional_object_mode() bsw@1222: return selector:exec() bsw@1222: end bsw@1222: bsw@1222: if not config.password_hash_algorithm then bsw@1222: config.password_hash_algorithm = "crypt_sha512" bsw@1222: end bsw@1222: bsw@1222: if not config.password_hash_min_rounds then bsw@1222: config.password_hash_min_rounds = 10000 bsw@1222: end bsw@1222: bsw@1222: if not config.password_hash_max_rounds then bsw@1222: config.password_hash_max_rounds = 20000 bsw@1222: end bsw@1222: bsw@1222: if config.enabled_languages == nil then bsw@1222: config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' } bsw@1222: end bsw@1222: bsw@1222: if config.default_lang == nil then bsw@1222: config.default_lang = "en" bsw@1222: end bsw@1222: bsw@1222: if config.mail_subject_prefix == nil then bsw@1222: config.mail_subject_prefix = "[LiquidFeedback] " bsw@1222: end bsw@1222: bsw@1222: if config.member_image_content_type == nil then bsw@1222: config.member_image_content_type = "image/jpeg" bsw@1222: end bsw@1222: bsw@1222: if config.member_image_convert_func == nil then bsw@1222: config.member_image_convert_func = { bsw@1222: avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end, bsw@1222: photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end bsw@1222: } bsw@1222: end bsw@1222: bsw@1222: if config.locked_profile_fields == nil then bsw@1222: config.locked_profile_fields = {} bsw@1222: end bsw@1222: bsw@1222: if config.check_delegations_default == nil then bsw@1222: config.check_delegations_default = "confirm" bsw@1222: end bsw@1222: bsw@1222: if config.ldap == nil then bsw@1222: config.ldap = {} bsw@1222: end bsw@1222: bsw@1222: if not config.database then bsw@1222: config.database = { engine='postgresql', dbname='liquid_feedback' } bsw@1222: end bsw@1222: jbe@1167: if config.fork == nil then bsw@1158: config.fork = {} bsw@1158: end bsw@1158: jbe@1167: if config.fork.pre == nil then jbe@1167: config.fork.pre = 2 bsw@1158: end bsw@1158: jbe@1167: if config.fork.min == nil then jbe@1167: config.fork.min = 4 jbe@1167: end jbe@1167: jbe@1167: if config.fork.max == nil then bsw@1169: config.fork.max = 128 bsw@1158: end bsw@1158: jbe@1167: if config.fork.delay == nil then jbe@1167: config.fork.delay = 0.125 jbe@1167: end jbe@1167: jbe@1167: if config.fork.error_delay == nil then jbe@1167: config.fork.error_delay = 2 bsw@1158: end bsw@1158: jbe@1167: if config.fork.exit_delay == nil then jbe@1167: config.fork.exit_delay = 2 jbe@1167: end jbe@1167: jbe@1167: if config.fork.idle_timeout == nil then jbe@1167: config.fork.idle_timeout = 900 jbe@1167: end jbe@1167: jbe@1167: if config.port == nil then bsw@1158: config.port = 8080 bsw@1158: end bsw@1158: bsw@1158: if config.localhost == nil then bsw@1158: config.localhost = true bsw@1158: end bsw@1158: jbe@1167: local listen_options = { jbe@1167: pre_fork = config.fork.pre, jbe@1167: min_fork = config.fork.min, jbe@1167: max_fork = config.fork.max, jbe@1167: fork_delay = config.fork.delay, jbe@1167: fork_error_delay = config.fork.error_delay, jbe@1167: exit_delay = config.fork.exit_delay, jbe@1167: idle_timeout = config.fork.idle_timeout, bsw@1169: memory_limit = config.fork.memory_limit, jbe@1167: min_requests_per_fork = config.fork.min_requests, jbe@1167: max_requests_per_fork = config.fork.max_requests, jbe@1167: http_options = config.http_options jbe@1167: } jbe@1167: jbe@1167: if config.ipv6 then bsw@1199: local host = config.localhost and "::1" or "::" bsw@1199: listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port } jbe@1167: end jbe@1167: if config.ipv6 ~= "only" then bsw@1202: local host = config.localhost and "127.0.0.1" or "0.0.0.0" bsw@1199: listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port } jbe@1167: end jbe@1167: bsw@1222: request.set_404_route{ module = 'index', view = '404' } bsw@1222: bsw@1222: request.set_absolute_baseurl(config.absolute_base_url) bsw@1222: jbe@1167: listen(listen_options) jbe@1167: bsw@1158: listen{ jbe@1167: { jbe@1167: proto = "interval", jbe@1167: name = "send_pending_notifications", jbe@1167: delay = 5, jbe@1167: handler = function() jbe@1167: Event:send_pending_notifications() jbe@1167: end jbe@1167: }, jbe@1167: min_fork = 1, jbe@1167: max_fork = 1 bsw@1158: } bsw@1158: bsw@1158: execute.inner() bsw@1158: