diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-03-15 02:56:44 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-03-15 02:56:44 +0000 |
commit | 0ae4e4464d090e98bd7daedae45320222a456599 (patch) | |
tree | 9d1703cb3c81cb42e28bbcdcb3587dd3a43b14c3 | |
parent | a0549526b82982e1e7ec4a612e3d895868c1dd47 (diff) | |
download | prosody-0ae4e4464d090e98bd7daedae45320222a456599.tar.gz prosody-0ae4e4464d090e98bd7daedae45320222a456599.zip |
portmanager: Allow services to specify their config option prefix
-rw-r--r-- | core/portmanager.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/portmanager.lua b/core/portmanager.lua index 605e1e30..a87e14eb 100644 --- a/core/portmanager.lua +++ b/core/portmanager.lua @@ -68,19 +68,23 @@ function activate_service(service_name) if not service_info then return nil, "Unknown service: "..service_name; end + + local config_prefix = (service_info.config_prefix or service_name).."_"; + if config_prefix == "_" then + config_prefix = ""; + end - local bind_interfaces = set.new(config.get("*", service_name.."_interfaces") - or config.get("*", service_name.."_interface") -- COMPAT w/pre-0.9 + local bind_interfaces = set.new(config.get("*", config_prefix.."interfaces") + or config.get("*", config_prefix.."interface") -- COMPAT w/pre-0.9 or (service_info.private and default_local_interfaces) or config.get("*", "interfaces") or config.get("*", "interface") -- COMPAT w/pre-0.9 or service_info.default_interface -- COMPAT w/pre0.9 or default_interfaces); - local bind_ports = set.new(config.get("*", service_name.."_ports") - or (service_info.multiplex and config.get("*", "ports")) or service_info.default_ports or {service_info.default_port}); + local bind_ports = set.new(config.get("*", config_prefix.."ports") local listener = service_info.listener; local mode = listener.default_mode or "*a"; |