liquid_feedback_frontend

annotate app/main/_prefork/10_init.lua @ 1253:235a36a08da1

Fixed cases where no use_term_checkboxes are defined in config
author bsw
date Sun Apr 17 16:06:18 2016 +0200 (2016-04-17)
parents 84f6e17c7ceb
children 32d5195a7152
rev   line source
bsw@1237 1 config.app_version = "3.1.0"
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@1253 24 if config.use_terms_checkboxes == nil then
bsw@1253 25 config.use_terms_checkboxes = {}
bsw@1253 26 end
bsw@1253 27
bsw@1222 28 if config.enabled_languages == nil then
bsw@1222 29 config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
bsw@1222 30 end
bsw@1222 31
bsw@1222 32 if config.default_lang == nil then
bsw@1222 33 config.default_lang = "en"
bsw@1222 34 end
bsw@1222 35
bsw@1222 36 if config.mail_subject_prefix == nil then
bsw@1222 37 config.mail_subject_prefix = "[LiquidFeedback] "
bsw@1222 38 end
bsw@1222 39
bsw@1250 40 if config.notification_digest_template == nil then
bsw@1250 41 config.notification_digest_template = "Hello #{name},\n\nthis is your personal digest.\n\n#{digest}\n"
bsw@1250 42 end
bsw@1250 43
bsw@1222 44 if config.member_image_content_type == nil then
bsw@1222 45 config.member_image_content_type = "image/jpeg"
bsw@1222 46 end
bsw@1222 47
bsw@1222 48 if config.member_image_convert_func == nil then
bsw@1222 49 config.member_image_convert_func = {
bsw@1222 50 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
bsw@1222 51 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
bsw@1222 52 }
bsw@1222 53 end
bsw@1222 54
bsw@1222 55 if config.locked_profile_fields == nil then
bsw@1222 56 config.locked_profile_fields = {}
bsw@1222 57 end
bsw@1222 58
bsw@1222 59 if config.check_delegations_default == nil then
bsw@1222 60 config.check_delegations_default = "confirm"
bsw@1222 61 end
bsw@1222 62
bsw@1222 63 if config.ldap == nil then
bsw@1222 64 config.ldap = {}
bsw@1222 65 end
bsw@1222 66
bsw@1222 67 if not config.database then
bsw@1222 68 config.database = { engine='postgresql', dbname='liquid_feedback' }
bsw@1222 69 end
bsw@1222 70
jbe@1167 71 if config.fork == nil then
bsw@1158 72 config.fork = {}
bsw@1158 73 end
bsw@1158 74
jbe@1167 75 if config.fork.pre == nil then
jbe@1167 76 config.fork.pre = 2
bsw@1158 77 end
bsw@1158 78
jbe@1167 79 if config.fork.min == nil then
jbe@1167 80 config.fork.min = 4
jbe@1167 81 end
jbe@1167 82
jbe@1167 83 if config.fork.max == nil then
bsw@1169 84 config.fork.max = 128
bsw@1158 85 end
bsw@1158 86
jbe@1167 87 if config.fork.delay == nil then
jbe@1167 88 config.fork.delay = 0.125
jbe@1167 89 end
jbe@1167 90
jbe@1167 91 if config.fork.error_delay == nil then
jbe@1167 92 config.fork.error_delay = 2
bsw@1158 93 end
bsw@1158 94
jbe@1167 95 if config.fork.exit_delay == nil then
jbe@1167 96 config.fork.exit_delay = 2
jbe@1167 97 end
jbe@1167 98
jbe@1167 99 if config.fork.idle_timeout == nil then
jbe@1167 100 config.fork.idle_timeout = 900
jbe@1167 101 end
jbe@1167 102
jbe@1167 103 if config.port == nil then
bsw@1158 104 config.port = 8080
bsw@1158 105 end
bsw@1158 106
bsw@1158 107 if config.localhost == nil then
bsw@1158 108 config.localhost = true
bsw@1158 109 end
bsw@1158 110
jbe@1167 111 local listen_options = {
jbe@1167 112 pre_fork = config.fork.pre,
jbe@1167 113 min_fork = config.fork.min,
jbe@1167 114 max_fork = config.fork.max,
jbe@1167 115 fork_delay = config.fork.delay,
jbe@1167 116 fork_error_delay = config.fork.error_delay,
jbe@1167 117 exit_delay = config.fork.exit_delay,
jbe@1167 118 idle_timeout = config.fork.idle_timeout,
bsw@1169 119 memory_limit = config.fork.memory_limit,
jbe@1167 120 min_requests_per_fork = config.fork.min_requests,
jbe@1167 121 max_requests_per_fork = config.fork.max_requests,
jbe@1167 122 http_options = config.http_options
jbe@1167 123 }
jbe@1167 124
jbe@1167 125 if config.ipv6 then
bsw@1199 126 local host = config.localhost and "::1" or "::"
bsw@1199 127 listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port }
jbe@1167 128 end
jbe@1167 129 if config.ipv6 ~= "only" then
bsw@1202 130 local host = config.localhost and "127.0.0.1" or "0.0.0.0"
bsw@1199 131 listen_options[#listen_options+1] = { proto = "tcp", host = host, port = config.port }
jbe@1167 132 end
jbe@1167 133
bsw@1222 134 request.set_404_route{ module = 'index', view = '404' }
bsw@1222 135
bsw@1222 136 request.set_absolute_baseurl(config.absolute_base_url)
bsw@1222 137
jbe@1167 138 listen(listen_options)
jbe@1167 139
bsw@1158 140 listen{
jbe@1167 141 {
jbe@1167 142 proto = "interval",
jbe@1167 143 name = "send_pending_notifications",
jbe@1167 144 delay = 5,
bsw@1248 145 handler = function()
bsw@1248 146 while true do
bsw@1250 147 if not Newsletter:send_next_newsletter() then
bsw@1250 148 break
bsw@1250 149 end
bsw@1250 150 end
bsw@1250 151 while true do
bsw@1250 152 if not Event:send_next_notification() then
bsw@1250 153 break
bsw@1250 154 end
bsw@1250 155 end
bsw@1250 156 while true do
bsw@1250 157 if not InitiativeForNotification:notify_next_member() then
bsw@1248 158 break
bsw@1248 159 end
bsw@1248 160 end
jbe@1167 161 end
jbe@1167 162 },
jbe@1167 163 min_fork = 1,
jbe@1167 164 max_fork = 1
bsw@1158 165 }
bsw@1158 166
bsw@1158 167 execute.inner()
bsw@1158 168

Impressum / About Us