webmcp
annotate demo-app/config/demo.lua @ 255:9e4be058959d
New functions request.add_initializer(...) and request.add_variable(...) to allow per-request initialization; Merged request.process() with request.handler(...)
author | jbe |
---|---|
date | Sat Mar 14 23:39:47 2015 +0100 (2015-03-14) |
parents | 2169a62e12f5 |
children | a2c733535b8e |
rev | line source |
---|---|
jbe/bsw@0 | 1 -- uncomment the following two lines to use C implementations of chosen |
jbe/bsw@0 | 2 -- functions and to disable garbage collection during the request, to |
jbe/bsw@0 | 3 -- increase speed: |
jbe/bsw@0 | 4 -- |
jbe/bsw@0 | 5 -- require 'webmcp_accelerator' |
jbe/bsw@0 | 6 -- collectgarbage("stop") |
jbe/bsw@0 | 7 |
jbe/bsw@0 | 8 -- open and set default database handle |
jbe@254 | 9 config.db = { |
jbe/bsw@0 | 10 engine='postgresql', |
jbe/bsw@0 | 11 dbname='webmcp_demo' |
jbe@254 | 12 } |
jbe/bsw@0 | 13 |
jbe@254 | 14 listen{ |
jbe@254 | 15 { proto = "tcp4", port = 8080 }, |
jbe@254 | 16 { proto = "tcp6", port = 8080 } |
jbe@254 | 17 } |
jbe@254 | 18 |
jbe@254 | 19 --[[ |
jbe/bsw@0 | 20 -- enable output of SQL commands in trace system |
jbe/bsw@0 | 21 function db:sql_tracer(command) |
jbe/bsw@0 | 22 return function(error_info) |
jbe/bsw@0 | 23 local error_info = error_info or {} |
jbe/bsw@0 | 24 trace.sql{ command = command, error_position = error_info.position } |
jbe/bsw@0 | 25 end |
jbe/bsw@0 | 26 end |
jbe@254 | 27 --]] |
jbe/bsw@0 | 28 |
jbe/bsw@0 | 29 -- 'request.get_relative_baseurl()' should be replaced by the absolute |
jbe/bsw@0 | 30 -- base URL of the application, as otherwise HTTP redirects will not be |
jbe/bsw@0 | 31 -- standard compliant |
jbe@254 | 32 --request.set_absolute_baseurl(request.get_relative_baseurl()) |
jbe/bsw@0 | 33 |
jbe/bsw@0 | 34 -- uncomment the following lines, if you want to use a database driven |
jbe/bsw@0 | 35 -- tempstore (for flash messages): |
jbe/bsw@0 | 36 -- |
jbe/bsw@0 | 37 -- function tempstore.save(blob) |
jbe/bsw@0 | 38 -- return Tempstore:create(blob) |
jbe/bsw@0 | 39 -- end |
jbe/bsw@0 | 40 -- function tempstore.pop(key) |
jbe/bsw@0 | 41 -- return Tempstore:data_by_key(key) |
jbe/bsw@0 | 42 -- end |
jbe/bsw@0 | 43 |
jbe/bsw@0 | 44 |