add autoconfig to validsubdomais if needed

This commit is contained in:
Peter Hormanns 2019-12-03 19:48:32 +01:00
parent b08bc28593
commit a759d312fc

View File

@ -410,7 +410,24 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
final Map<String, Object> templateVars = new HashMap<String, Object>(); final Map<String, Object> templateVars = new HashMap<String, Object>();
query.setParameter("hivename", hiveName); query.setParameter("hivename", hiveName);
query.setParameter("option", "letsencrypt"); query.setParameter("option", "letsencrypt");
templateVars.put("domains", query.getResultList()); final List<?> domainsResultList = query.getResultList();
for (Object domObj : domainsResultList) {
if (domObj instanceof Domain) {
final Domain d = (Domain) domObj;
boolean autoconfig = false;
final Set<DomainOption> domainoptions = d.getDomainoptions();
for (DomainOption opt : domainoptions) {
if ("autoconfig".equals(opt.getName())) {
autoconfig = true;
}
}
final String validSubdomains = d.getValidsubdomainnames();
if (autoconfig && !validSubdomains.contains("autoconfig")) {
d.setValidsubdomainnames(validSubdomains + ",autoconfig");
}
}
}
templateVars.put("domains", domainsResultList);
return new CompoundProcessor( return new CompoundProcessor(
new CreateFileProcessor("/de/hsadmin/mods/dom/acmebot-domain.properties.vm", templateVars, dom, new CreateFileProcessor("/de/hsadmin/mods/dom/acmebot-domain.properties.vm", templateVars, dom,
"/etc/hostsharing/acmebot/domain.properties.tmp", "acmebot", "acmebot", "640", true), "/etc/hostsharing/acmebot/domain.properties.tmp", "acmebot", "acmebot", "640", true),