# HG changeset patch # User Kim Alvefur # Date 1637325921 -3600 # Node ID 6395d4732bc603a60fa5c19ffd2a9d2328fad0fb # Parent 229f2a79ad6f99be672b14cf39ce0f842c5f9209 mod_dnsupdate: Add support for components diff -r 229f2a79ad6f -r 6395d4732bc6 mod_dnsupdate/mod_dnsupdate.lua --- 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");