# HG changeset patch # User Matthew Wild # Date 1335418871 -3600 # Node ID 5a85e541de1a8171e7c63510c76b38b1afe81056 # Parent 3ce9e1ca9c15be88347006286ab307681ad86dce mod_http: Switch to single option for specifying HTTP app bases, http_paths. Keys are app/module names, values are base paths. diff -r 3ce9e1ca9c15 -r 5a85e541de1a plugins/mod_http.lua --- a/plugins/mod_http.lua Thu Apr 26 06:30:29 2012 +0100 +++ b/plugins/mod_http.lua Thu Apr 26 06:41:11 2012 +0100 @@ -29,6 +29,12 @@ return method:upper().." "..host..app_path..path; end +local function get_base_path(host_module, app_name, default_app_path) + return host_module:get_option("http_paths", {})[app_name] -- Host + or module:get_option("http_paths", {})[app_name] -- Global + or default_app_path; -- Default +end + function module.add_host(module) local host = module.host; local apps = {}; @@ -36,7 +42,7 @@ local function http_app_added(event) local app_name = event.item.name; local default_app_path = event.item.default_path or "/"..app_name; - local app_path = normalize_path(module:get_option_string(app_name.."_http_path", default_app_path)); + local app_path = normalize_path(get_base_path(module, app_name, default_app_path)); if not app_name then -- TODO: Link to docs module:log("error", "HTTP app has no 'name', add one or use module:provides('http', app)");