3 (c) 2009 Steven Barth <steven@midlink.org>
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
14 local ipairs, pcall, type = ipairs, pcall, type
15 local luci = require "luci.lucid.http.handler.luci"
16 local srv = require "luci.lucid.http.server"
19 module "luci.lucid.http.LuciWebPublisher"
21 function factory(server, config)
23 require "luci.dispatcher"
27 config.domain = config.domain or ""
28 local vhost = server:get_vhosts()[config.domain]
31 server:set_vhost(config.domain, vhost)
35 if config.physical and #config.physical > 0 then
37 for k in config.physical:gmatch("[^/]+") do
44 local handler = luci.Luci(config.name, prefix)
46 for _, r in ipairs(config.exec) do
47 if r:sub(1,1) == ":" then
48 handler:restrict({interface = r:sub(2)})
50 handler:restrict({user = r})
55 if type(config.virtual) == "table" then
56 for _, v in ipairs(config.virtual) do
57 vhost:set_handler(v, handler)
60 vhost:set_handler(config.virtual, handler)