annotate demo-app/config/demo.lua @ 393:b2d2ff6e4385
Added <db_handle>:wait(...) method to wait for NOTIFYs
 | author | 
 jbe | 
 | date | 
 Wed Dec 09 03:40:27 2015 +0100 (2015-12-09) | 
 | parents | 
 a2c733535b8e  | 
 | children | 
 f5d2d0ccb94a  | 
 
 | 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@316
 | 
    16   { proto = "tcp6", port = 8080 },
 | 
| 
jbe@316
 | 
    17   { proto = "interval", delay = 60, handler = function() io.stderr:write("Background job executed here\n") end }
 | 
| 
jbe@254
 | 
    18 }
 | 
| 
jbe@254
 | 
    19 
 | 
| 
jbe@254
 | 
    20 --[[
 | 
| 
jbe/bsw@0
 | 
    21 -- enable output of SQL commands in trace system
 | 
| 
jbe/bsw@0
 | 
    22 function db:sql_tracer(command)
 | 
| 
jbe/bsw@0
 | 
    23   return function(error_info)
 | 
| 
jbe/bsw@0
 | 
    24     local error_info = error_info or {}
 | 
| 
jbe/bsw@0
 | 
    25     trace.sql{ command = command, error_position = error_info.position }
 | 
| 
jbe/bsw@0
 | 
    26   end
 | 
| 
jbe/bsw@0
 | 
    27 end
 | 
| 
jbe@254
 | 
    28 --]]
 | 
| 
jbe/bsw@0
 | 
    29 
 | 
| 
jbe/bsw@0
 | 
    30 -- 'request.get_relative_baseurl()' should be replaced by the absolute
 | 
| 
jbe/bsw@0
 | 
    31 -- base URL of the application, as otherwise HTTP redirects will not be
 | 
| 
jbe/bsw@0
 | 
    32 -- standard compliant
 | 
| 
jbe@254
 | 
    33 --request.set_absolute_baseurl(request.get_relative_baseurl())
 | 
| 
jbe/bsw@0
 | 
    34 
 | 
| 
jbe/bsw@0
 | 
    35 -- uncomment the following lines, if you want to use a database driven
 | 
| 
jbe/bsw@0
 | 
    36 -- tempstore (for flash messages):
 | 
| 
jbe/bsw@0
 | 
    37 --
 | 
| 
jbe/bsw@0
 | 
    38 -- function tempstore.save(blob)
 | 
| 
jbe/bsw@0
 | 
    39 --   return Tempstore:create(blob)
 | 
| 
jbe/bsw@0
 | 
    40 -- end
 | 
| 
jbe/bsw@0
 | 
    41 -- function tempstore.pop(key)
 | 
| 
jbe/bsw@0
 | 
    42 --   return Tempstore:data_by_key(key)
 | 
| 
jbe/bsw@0
 | 
    43 -- end
 | 
| 
jbe/bsw@0
 | 
    44 
 | 
| 
jbe/bsw@0
 | 
    45 
 |