no autoconfig subdomain

This commit is contained in:
Peter Hormanns 2020-02-19 10:19:14 +01:00
parent 5fa888adcc
commit 69c0882228
2 changed files with 4 additions and 26 deletions

View File

@ -28,7 +28,7 @@ public class DomainModuleImpl extends AbstractModuleImpl {
public static final String DOMOPT_INCLUDES = "includes"; public static final String DOMOPT_INCLUDES = "includes";
public static final String DOMOPT_BACKUPFOREXTERNALMX = "backupmxforexternalmx"; public static final String DOMOPT_BACKUPFOREXTERNALMX = "backupmxforexternalmx";
public static final String DOMOPT_LETSENCRYPT = "letsencrypt"; public static final String DOMOPT_LETSENCRYPT = "letsencrypt";
// public static final String DOMOPT_PHP5 = "php5"; public static final String DOMOPT_AUTOCONFIG = "autoconfig";
public static final String[] ALL_DOMOPTS = public static final String[] ALL_DOMOPTS =
new String[] { new String[] {
@ -38,8 +38,8 @@ public class DomainModuleImpl extends AbstractModuleImpl {
DOMOPT_HTDOCSFALLBACK, DOMOPT_HTDOCSFALLBACK,
DOMOPT_INCLUDES, DOMOPT_INCLUDES,
DOMOPT_BACKUPFOREXTERNALMX, DOMOPT_BACKUPFOREXTERNALMX,
DOMOPT_LETSENCRYPT DOMOPT_LETSENCRYPT,
// , DOMOPT_PHP5 DOMOPT_AUTOCONFIG
}; };
public static final String[] DEFAULT_DOMOPTS = public static final String[] DEFAULT_DOMOPTS =
new String[] { new String[] {

View File

@ -410,29 +410,7 @@ 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");
final List<?> domainsResultList = query.getResultList(); templateVars.put("domains", 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")) {
if (validSubdomains.length() > 0) {
d.setValidsubdomainnames(validSubdomains + ",autoconfig");
}
else {
d.setValidsubdomainnames("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),