bsw/jbe@0: config.app_name = "LiquidFeedback" bsw@2: config.app_version = "alpha3" bsw/jbe@0: bsw/jbe@0: config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)" bsw/jbe@0: bsw/jbe@0: config.app_service_provider = "Snake Oil
10000 Berlin
Germany" bsw/jbe@0: bsw@2: config.member_image_convert = { bsw@2: avatar = { "convert", "-", "-thumbnail", "48x48", "-" } bsw@2: } bsw@2: bsw/jbe@0: -- uncomment the following two lines to use C implementations of chosen bsw/jbe@0: -- functions and to disable garbage collection during the request, to bsw/jbe@0: -- increase speed: bsw/jbe@0: -- bsw/jbe@0: -- require 'webmcp_accelerator' bsw/jbe@0: -- collectgarbage("stop") bsw/jbe@0: bsw/jbe@0: -- open and set default database handle bsw/jbe@0: db = assert(mondelefant.connect{ bsw/jbe@0: engine='postgresql', bsw/jbe@0: dbname='liquid_feedback' bsw/jbe@0: }) bsw/jbe@0: at_exit(function() bsw/jbe@0: db:close() bsw/jbe@0: end) bsw/jbe@0: function mondelefant.class_prototype:get_db_conn() return db end bsw/jbe@0: bsw/jbe@0: -- enable output of SQL commands in trace system bsw/jbe@0: function db:sql_tracer(command) bsw/jbe@0: return function(error_info) bsw/jbe@0: local error_info = error_info or {} bsw/jbe@0: trace.sql{ command = command, error_position = error_info.position } bsw/jbe@0: end bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: -- 'request.get_relative_baseurl()' should be replaced by the absolute bsw/jbe@0: -- base URL of the application, as otherwise HTTP redirects will not be bsw/jbe@0: -- standard compliant bsw/jbe@0: request.set_absolute_baseurl(request.get_relative_baseurl()) bsw/jbe@0: bsw/jbe@0: bsw/jbe@0: bsw@2: -- TODO abstraction bsw/jbe@0: -- get record by id bsw/jbe@0: function mondelefant.class_prototype:by_id(id) bsw/jbe@0: local selector = self:new_selector() bsw/jbe@0: selector:add_where{ 'id = ?', id } bsw/jbe@0: selector:optional_object_mode() bsw/jbe@0: return selector:exec() bsw/jbe@0: end bsw/jbe@0: bsw@2: