diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-26 06:41:11 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-26 06:41:11 +0100 |
commit | 6c6566bacef8de2a8d98f2f9640c7a713f2371d2 (patch) | |
tree | ebc7a962d479a0e865c9baa7212e8f6600df6b5c /plugins | |
parent | 19f0eb98bf99be6d07504a5436e935d4c6b1d189 (diff) | |
download | prosody-6c6566bacef8de2a8d98f2f9640c7a713f2371d2.tar.gz prosody-6c6566bacef8de2a8d98f2f9640c7a713f2371d2.zip |
mod_http: Switch to single option for specifying HTTP app bases, http_paths. Keys are app/module names, values are base paths.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 2ba69cb5..8b8d9c47 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -29,6 +29,12 @@ local function get_http_event(host, app_path, key) 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 @@ function module.add_host(module) 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)"); |