From bf2a2a885ebf7c8919500e64b09584bec5661280 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Wed, 17 Jan 2024 12:11:24 +0100 Subject: [PATCH] provide path variables to vhost template --- .../de/hsadmin/mods/dom/DomainProcessorFactory.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java b/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java index d8f6357..fdd5b9f 100644 --- a/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java +++ b/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java @@ -267,6 +267,10 @@ public class DomainProcessorFactory implements EntityProcessorFactory { ifOption(templateVars, query, "passengerfriendlyerrorpages", Boolean.TRUE, Boolean.FALSE); ifOption(templateVars, query, "cgi", Boolean.TRUE, Boolean.FALSE); ifOption(templateVars, query, "fastcgi", Boolean.TRUE, Boolean.FALSE); + setPathInTemplate(templateVars, "passengerpython", "/usr/bin/python3", dom.getPassengerpython()); + setPathInTemplate(templateVars, "passengernodejs", "/usr/bin/node", dom.getPassengernodejs()); + setPathInTemplate(templateVars, "passengerruby", "/usr/bin/ruby", dom.getPassengerruby()); + setPathInTemplate(templateVars, "fcgiphpbin", "/usr/bin/php", dom.getFcgiphpbin()); final boolean isSetLetsencryptOption = templateVars.get("letsencrypt").equals(Boolean.TRUE); final Processor domSetupProcessor = new CompoundProcessor( isSetLetsencryptOption ? new NullProcessor() : new ShellProcessor("rm -f /etc/apache2/pems-generated/" + domName + ".crt"), @@ -296,6 +300,14 @@ public class DomainProcessorFactory implements EntityProcessorFactory { return domSetupProcessor; } + private void setPathInTemplate(final Map templateVars, final String templateVariable, final String defaultPath, final String actualPath) { + String pathVariable = actualPath; + if (pathVariable == null || pathVariable.isEmpty()) { + pathVariable = defaultPath; + } + templateVars.put(templateVariable, pathVariable); + } + private void ifOption(Map templateVars, Query query, String option, Object optIsTrue, Object optIsFalse) { query.setParameter("option", option); if (query.getResultList().isEmpty()) {