webmcp
changeset 211:9d3d11cf1bf6
Changes in mcp.lua regarding configuration management (only single application allowed)
author | jbe |
---|---|
date | Sat Jan 10 00:36:05 2015 +0100 (2015-01-10) |
parents | 474cf0cfb85b |
children | 47ebf4213716 |
files | framework/bin/mcp.lua |
line diff
1.1 --- a/framework/bin/mcp.lua Sat Jan 10 00:28:03 2015 +0100 1.2 +++ b/framework/bin/mcp.lua Sat Jan 10 00:36:05 2015 +0100 1.3 @@ -178,7 +178,12 @@ 1.4 end 1.5 }) 1.6 1.7 --- execute configurations 1.8 +-- replace Moonbridge listen function and execute configurations 1.9 +local moonbridge_listen = listen 1.10 +local listeners 1.11 +function _G.listen(args) 1.12 + listeners[#listeners+1] = args 1.13 +end 1.14 for i, config_name in ipairs(WEBMCP_CONFIG_NAMES) do 1.15 execute.config(config_name) 1.16 end 1.17 @@ -191,27 +196,17 @@ 1.18 -- invoke moonbridge 1.19 if WEBMCP_MODE == "listen" then 1.20 local http = require("moonbridge_http") 1.21 - local moonbridge_listen = listen 1.22 - local listeners 1.23 - function _G.listen(args) 1.24 - listeners[#listeners+1] = args 1.25 - end 1.26 - for i = 1, #extraargs/2 do 1.27 - local config = {} 1.28 - listeners = {} 1.29 - execute.config(config_name) 1.30 - for i, listener in ipairs(listeners) do 1.31 - listener.prepare = execute.prefork_initializers 1.32 - listener.connect = http.generate_handler( 1.33 - request.get_http_options(), 1.34 - function(http_request) 1.35 - execute.postfork_initializers() 1.36 - request.handler(http_request) 1.37 - end 1.38 - ) 1.39 - listener.finish = execute.finalizers 1.40 - moonbridge_listen(listener) 1.41 - end 1.42 + for i, listener in ipairs(listeners) do 1.43 + listener.prepare = execute.prefork_initializers 1.44 + listener.connect = http.generate_handler( 1.45 + request.get_http_options(), 1.46 + function(http_request) 1.47 + execute.postfork_initializers() 1.48 + request.handler(http_request) 1.49 + end 1.50 + ) 1.51 + listener.finish = execute.finalizers 1.52 + moonbridge_listen(listener) 1.53 end 1.54 end 1.55