liquid_feedback_frontend

view config/init.lua @ 1147:24787d0d9317

Updated delivery and cache control of member images
author bsw
date Sun Mar 22 17:32:38 2015 +0100 (2015-03-22)
parents 904f6807f7fa
children 911253ad0898
line source
1 -- ========================================================================
2 -- DO NOT CHANGE ANYTHING IN THIS FILE
3 -- (except when you really know what you are doing!)
4 -- ========================================================================
6 config.app_version = "3.0.4"
8 if not config.password_hash_algorithm then
9 config.password_hash_algorithm = "crypt_sha512"
10 end
12 if not config.password_hash_min_rounds then
13 config.password_hash_min_rounds = 10000
14 end
16 if not config.password_hash_max_rounds then
17 config.password_hash_max_rounds = 20000
18 end
20 if config.enabled_languages == nil then
21 config.enabled_languages = { 'en', 'de', 'ka' } --, 'eo', 'el', 'hu', 'it', 'nl', 'zh-Hans', 'zh-TW' }
22 end
24 if config.default_lang == nil then
25 config.default_lang = "en"
26 end
28 if config.mail_subject_prefix == nil then
29 config.mail_subject_prefix = "[LiquidFeedback] "
30 end
32 if config.member_image_content_type == nil then
33 config.member_image_content_type = "image/jpeg"
34 end
36 if config.member_image_convert_func == nil then
37 config.member_image_convert_func = {
38 avatar = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "48x48", "jpeg:-") end,
39 photo = function(data) return extos.pfilter(data, "convert", "jpeg:-", "-thumbnail", "240x240", "jpeg:-") end
40 }
41 end
43 if config.locked_profile_fields == nil then
44 config.locked_profile_fields = {}
45 end
47 if config.check_delegations_default == nil then
48 config.check_delegations_default = "confirm"
49 end
51 if config.ldap == nil then
52 config.ldap = {}
53 end
55 if not config.database then
56 config.database = { engine='postgresql', dbname='liquid_feedback' }
57 end
59 request.set_404_route{ module = 'index', view = '404' }
61 request.set_absolute_baseurl(config.absolute_base_url)
63 -- TODO abstraction
64 -- get record by id
65 function mondelefant.class_prototype:by_id(id)
66 local selector = self:new_selector()
67 selector:add_where{ 'id = ?', id }
68 selector:optional_object_mode()
69 return selector:exec()
70 end
72 -- compatibility for WebMCP 1.2.6
73 if not listen then
75 -- open and set default database handle
76 _G.db = assert(mondelefant.connect(config.database))
78 function mondelefant.class_prototype:get_db_conn() return db end
80 -- enable output of SQL commands in trace system
81 function db:sql_tracer(command)
82 return function(error_info)
83 local error_info = error_info or {}
84 trace.sql{ command = command, error_position = error_info.position }
85 end
86 end
88 -- close the database at exit
89 at_exit(function()
90 db:close()
91 end)
93 function request.get_cookie(args)
94 return cgi.cookies[args.name]
95 end
97 function request.get_param(args)
98 return request.get_param_strings()[args.name]
99 end
101 function request.add_header(key, value)
102 print(key .. ": " .. value)
103 end
105 local request_redirect = request.redirect
106 function request.redirect(args)
107 if args.static then
108 print('Location: ' .. encode.url{ static = args.static } .. '\n\n')
109 exit()
110 else
111 request_redirect(args)
112 end
113 end
115 function request.allow_caching()
116 request.add_header("Cache-Control", "max-age=3600");
117 end
119 return
120 end
122 if not config.fork then
123 config.fork = {}
124 end
126 if not config.fork.pre then
127 config.fork.pre = 4
128 end
130 if not config.fork.max then
131 config.fork.max = 8
132 end
134 if not config.fork.delay then
135 config.fork.delay = 1
136 end
138 if not config.port then
139 config.port = 8080
140 end
142 listen{
143 { proto = "tcp4", port = config.port, localhost = true },
144 pre_fork = config.fork.pre,
145 max_fork = config.fork.max,
146 fork_delay = config.fork.delay
147 }

Impressum / About Us