parent
e61b75b101
commit
b1346229d2
1 changed files with 33 additions and 0 deletions
@ -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', |
||||
}); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue