Commit ab620e32 authored by Antoine Cellerier's avatar Antoine Cellerier

Make the lua http interface host and directory configurable.

parent f4514d7d
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
--[==========================================================================[ --[==========================================================================[
Configuration options: Configuration options:
* host: A host to listen on.
* dir: Directory to use a the http interface's root.
* no_error_detail: If set, do not print the Lua error message when generating * no_error_detail: If set, do not print the Lua error message when generating
a page fails. a page fails.
* no_index: If set, don't build directory indexes * no_index: If set, don't build directory indexes
...@@ -188,7 +190,7 @@ local function find_datadir(name) ...@@ -188,7 +190,7 @@ local function find_datadir(name)
end end
error("Unable to find the `"..name.."' directory.") error("Unable to find the `"..name.."' directory.")
end end
http_dir = find_datadir("http-lua") http_dir = config.dir or find_datadir("http-lua")
do do
local oldpath = package.path local oldpath = package.path
...@@ -260,7 +262,8 @@ local function load_dir(dir,root,parent_acl) ...@@ -260,7 +262,8 @@ local function load_dir(dir,root,parent_acl)
end end
end end
h = httpd.new("localhost",8080) local u = vlc.net.url_parse( config.host or "localhost:8080" )
h = httpd.new(u.host,u.port)
load_dir( http_dir ) load_dir( http_dir )
while not die do die = vlc.lock_and_wait() end -- everything happens in callbacks while not die do die = vlc.lock_and_wait() end -- everything happens in callbacks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment