Software /
code /
prosody
Comparison
core/portmanager.lua @ 4615:29a9988c1e1b
portmanager: Allow services to specify their config option prefix
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 15 Mar 2012 02:56:44 +0000 |
parent | 4612:8bb93860fe46 |
child | 4616:03d9fe1bcdd3 |
comparison
equal
deleted
inserted
replaced
4614:20940729c1b4 | 4615:29a9988c1e1b |
---|---|
66 function activate_service(service_name) | 66 function activate_service(service_name) |
67 local service_info = services[service_name][1]; | 67 local service_info = services[service_name][1]; |
68 if not service_info then | 68 if not service_info then |
69 return nil, "Unknown service: "..service_name; | 69 return nil, "Unknown service: "..service_name; |
70 end | 70 end |
71 | |
72 local config_prefix = (service_info.config_prefix or service_name).."_"; | |
73 if config_prefix == "_" then | |
74 config_prefix = ""; | |
75 end | |
71 | 76 |
72 local bind_interfaces = set.new(config.get("*", service_name.."_interfaces") | 77 local bind_interfaces = set.new(config.get("*", config_prefix.."interfaces") |
73 or config.get("*", service_name.."_interface") -- COMPAT w/pre-0.9 | 78 or config.get("*", config_prefix.."interface") -- COMPAT w/pre-0.9 |
74 or (service_info.private and default_local_interfaces) | 79 or (service_info.private and default_local_interfaces) |
75 or config.get("*", "interfaces") | 80 or config.get("*", "interfaces") |
76 or config.get("*", "interface") -- COMPAT w/pre-0.9 | 81 or config.get("*", "interface") -- COMPAT w/pre-0.9 |
77 or service_info.default_interface -- COMPAT w/pre0.9 | 82 or service_info.default_interface -- COMPAT w/pre0.9 |
78 or default_interfaces); | 83 or default_interfaces); |
79 | 84 |
80 local bind_ports = set.new(config.get("*", service_name.."_ports") | |
81 or (service_info.multiplex and config.get("*", "ports")) | |
82 or service_info.default_ports | 85 or service_info.default_ports |
83 or {service_info.default_port}); | 86 or {service_info.default_port}); |
87 local bind_ports = set.new(config.get("*", config_prefix.."ports") | |
84 | 88 |
85 local listener = service_info.listener; | 89 local listener = service_info.listener; |
86 local mode = listener.default_mode or "*a"; | 90 local mode = listener.default_mode or "*a"; |
87 local ssl; | 91 local ssl; |
88 if service_info.encryption == "ssl" then | 92 if service_info.encryption == "ssl" then |