diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/81SimpleVHosts b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/81SimpleVHosts new file mode 100644 index 0000000..8f5afd6 --- /dev/null +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/81SimpleVHosts @@ -0,0 +1,33 @@ +{ + $OUT = ''; + + use esmith::DomainsDB; + + my $db = esmith::DomainsDB->open_ro; + unless ($db){ + warn "Couldn't open domains DB in VirtualHosts template fragment"; + return; + } + + my @vhosts = $db->get_all_by_prop('type' => 'vhost'); + foreach my $vhost (@vhosts) { + my $templatePath = $vhost->prop('TemplatePath') || 'VirtualHosts'; + foreach my $port (qw(80 443)){ + my %virtualHost = ( + ipAddress => '0.0.0.0', + port => $port, + localAccess => $localAccess, + externalSSLAccess => $externalSSLAccess, + domain => $vhost, + ); + + $OUT .= esmith::templates::processTemplate ( + { + MORE_DATA => \%virtualHost, + TEMPLATE_PATH => + "/etc/httpd/conf/httpd.conf/$templatePath", + OUTPUT_TYPE => 'string', + }); + } + } +}