liquid_feedback_frontend

view config/init.lua @ 731:0015fa6eb637

Made config easier
author bsw
date Thu Jun 28 17:21:16 2012 +0200 (2012-06-28)
parents f52f918b38b8
children 3a61d21618f6
line source
1 config.app_version = "2.beta12"
3 if not config.instance_name then
4 config.instance_name = request.get_config_name()
5 end
7 if
8 not config.app_service_provider or
9 not config.use_terms or
10 not config.use_terms_checkboxes
11 then
12 error("Missing mandatory config option")
13 end
15 if config.enabled_languages == nil then
16 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
17 end
19 if config.default_lang == nil then
20 config.default_lang = "en"
21 end
23 if config.mail_subject_prefix == nil then
24 config.mail_subject_prefix = "[LiquidFeedback] "
25 end
27 if config.absolute_base_url == nil then
28 config.absolute_base_url = request.get_relative_baseurl()
29 end
31 if config.member_image_content_type == nil then
32 config.member_image_content_type = "image/jpeg"
33 end
35 if config.member_image_convert_func == nil then
36 config.member_image_convert_func = {
37 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
38 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
39 }
40 end
42 request.set_404_route{ module = 'index', view = '404' }
44 -- open and set default database handle
45 db = assert(mondelefant.connect{
46 engine='postgresql',
47 dbname='liquid_feedback'
48 })
49 at_exit(function()
50 db:close()
51 end)
52 function mondelefant.class_prototype:get_db_conn() return db end
54 -- enable output of SQL commands in trace system
55 function db:sql_tracer(command)
56 return function(error_info)
57 local error_info = error_info or {}
58 trace.sql{ command = command, error_position = error_info.position }
59 end
60 end
62 request.set_absolute_baseurl(config.absolute_base_url)
66 -- TODO abstraction
67 -- get record by id
68 function mondelefant.class_prototype:by_id(id)
69 local selector = self:new_selector()
70 selector:add_where{ 'id = ?', id }
71 selector:optional_object_mode()
72 return selector:exec()
73 end

Impressum / About Us