* Introducing LuCI HTTPD as testing environment
[project/luci.git] / libs / httpd / host / runluci
diff --git a/libs/httpd/host/runluci b/libs/httpd/host/runluci
new file mode 100755 (executable)
index 0000000..c9c93dd
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/lua
+require("luci.httpd")
+require("luci.httpd.server")
+require("luci.httpd.handler.file")
+require("luci.httpd.handler.luci")
+
+DOCROOT = arg[1]
+PORT = 8080
+
+
+serversocket = luci.httpd.Socket("0.0.0.0", PORT)
+
+
+server  = luci.httpd.server.Server()
+vhost   = luci.httpd.server.VHost()
+
+server:set_default_vhost(vhost)
+
+
+filehandler = luci.httpd.handler.file.Simple(DOCROOT)
+vhost:set_default_handler(filehandler)
+
+lucihandler = luci.httpd.handler.luci.Luci()
+vhost:set_handler("/luci", lucihandler)
+
+io.stderr:write("Starting LuCI HTTPD on port " .. PORT .. "...\n")
+io.stderr:write("Point your browser to http://localhost:" .. PORT .. "/luci\n")
+
+daemon = luci.httpd.Daemon()
+daemon.debug = true
+daemon:register(serversocket, server:create_daemon_handlers())
+daemon:run()