liquid_feedback_frontend

view config/init.lua @ 734:9d104952554a

Completed cleanup of config
author bsw
date Thu Jun 28 17:32:48 2012 +0200 (2012-06-28)
parents 3a61d21618f6
children e642bf111347
line source
1 -- ========================================================================
2 -- DO NOT CHANGE ANYTHING IN THIS FILE
3 -- (except when you really know what you are doing!)
4 -- ========================================================================
7 config.app_version = "2.beta12"
9 if not config.instance_name then
10 config.instance_name = request.get_config_name()
11 end
13 if
14 not config.app_service_provider or
15 not config.use_terms or
16 not config.use_terms_checkboxes
17 then
18 error("Missing mandatory config option")
19 end
21 if config.enabled_languages == nil then
22 config.enabled_languages = { 'en', 'de', 'eo', 'el', 'hu' }
23 end
25 if config.default_lang == nil then
26 config.default_lang = "en"
27 end
29 if config.mail_subject_prefix == nil then
30 config.mail_subject_prefix = "[LiquidFeedback] "
31 end
33 if config.absolute_base_url == nil then
34 config.absolute_base_url = request.get_relative_baseurl()
35 end
37 if config.member_image_content_type == nil then
38 config.member_image_content_type = "image/jpeg"
39 end
41 if config.member_image_convert_func == nil then
42 config.member_image_convert_func = {
43 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
44 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
45 }
46 end
48 if config.public_access == nil then
49 config.public_access = "full"
50 end
52 if not config.database then
53 config.database = { engine='postgresql', dbname='liquid_feedback' }
54 end
56 request.set_404_route{ module = 'index', view = '404' }
58 -- open and set default database handle
59 db = assert(mondelefant.connect(config.database))
60 at_exit(function()
61 db:close()
62 end)
63 function mondelefant.class_prototype:get_db_conn() return db end
65 -- enable output of SQL commands in trace system
66 function db:sql_tracer(command)
67 return function(error_info)
68 local error_info = error_info or {}
69 trace.sql{ command = command, error_position = error_info.position }
70 end
71 end
73 request.set_absolute_baseurl(config.absolute_base_url)
76 -- TODO abstraction
77 -- get record by id
78 function mondelefant.class_prototype:by_id(id)
79 local selector = self:new_selector()
80 selector:add_where{ 'id = ?', id }
81 selector:optional_object_mode()
82 return selector:exec()
83 end

Impressum / About Us