changeset 4779:6395d4732bc6

mod_dnsupdate: Add support for components
author Kim Alvefur <zash@zash.se>
date Fri, 19 Nov 2021 13:45:21 +0100
parents 229f2a79ad6f
children 4abb33a15897
files mod_dnsupdate/mod_dnsupdate.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_dnsupdate/mod_dnsupdate.lua	Thu Nov 18 19:39:38 2021 +0100
+++ b/mod_dnsupdate/mod_dnsupdate.lua	Fri Nov 19 13:45:21 2021 +0100
@@ -8,7 +8,8 @@
 local nameprep = require"util.encodings".stringprep.nameprep;
 local idna_to_ascii = require"util.encodings".idna.to_ascii;
 
-local services = { "xmpp-client"; "xmpps-client"; "xmpp-server"; "xmpps-server" }
+local virtualhost_services = { "xmpp-client"; "xmpps-client"; "xmpp-server"; "xmpps-server" }
+local component_services = { "xmpp-server"; "xmpps-server" }
 
 local function validate_dnsname_option(options, option_name, default)
 	local host = options[option_name];
@@ -54,11 +55,15 @@
 		module:log("error", "Host %q falis IDNA", vhost);
 		return 1;
 	end
-	if not config.get(vhost, "defined") then
+	local is_component = config.get(vhost, "component_module");
+	if not is_component and not config.get(vhost, "defined") then
 		module:log("error", "Host %q is not defined in the config", vhost);
 		return 1;
 	end
 
+	local services = virtualhost_services;
+	if is_component then services = component_services; end
+
 	local domain = validate_dnsname_option(opts, "domain");
 	if not domain then
 		module:log("error", "--domain is required");