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 | eafbf7d47eb4e65a8efb9b9daea112b470d3f4c8 (patch) | |
tree | 9d1703cb3c81cb42e28bbcdcb3587dd3a43b14c3 /core | |
parent | 78cd9a0ddcb2e3af03173eeceec270ef804603ec (diff) | |
download | prosody-eafbf7d47eb4e65a8efb9b9daea112b470d3f4c8.tar.gz prosody-eafbf7d47eb4e65a8efb9b9daea112b470d3f4c8.zip |
portmanager: Allow services to specify their config option prefix
Diffstat (limited to 'core')
-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"; |