Apache-SdnFw

 view release on metacpan or  search on metacpan

lib/Apache/SdnFw/bin/conf.pl  view on Meta::CPAN

#!/usr/bin/perl -lw
use strict;

print <<END;
### Autogenerated httpd.conf
##
## Do not edit this file. All changes will be lost the next time the server
## starts, restarts, reloads, or is configtested
##
## If you need to make a change to this, please change conf.pl
##
END

die "\$HTTPD_ROOT not defined!" unless $ENV{HTTPD_ROOT};
print "ServerRoot $ENV{HTTPD_ROOT}";

die "\$HTTP_PORT not defined!" unless $ENV{HTTP_PORT};
die "\$HTTPS_PORT not defined!" unless $ENV{HTTPS_PORT};

#
# Discover the hostname and IP address of the server.
#
# look for the sdnfw.conf file in HTTPD_ROOT
# if it is not there they we can not do anything
unless(-f "$ENV{HTTPD_ROOT}/conf/sdnfw.conf") {
	die "$ENV{HTTPD_ROOT}/conf/sdnfw.conf file not found";
}
open F, "$ENV{HTTPD_ROOT}/conf/sdnfw.conf";
while (my $l = <F>) {
	chomp $l;
	next if ($l =~ m/^#/);
	my ($k,$v) = split '=', $l;
	$ENV{$k} = $v;
}
close F;

die "SERVER_NAME not defined in $ENV{HTTPD_ROOT}/conf/sdnfw.conf"
	unless($ENV{SERVER_NAME});
die "IP_ADDR not defined in $ENV{HTTPD_ROOT}/conf/sdnfw.conf"
	unless($ENV{IP_ADDR});

print "ServerName $ENV{SERVER_NAME}";

$ENV{APACHE_SERVER_NAME} = $ENV{SERVER_NAME};
#
# Obtain server-wide configuration items.
#
print 'ServerType standalone';
my $user = ($ENV{HTTPD_USER}) ? $ENV{HTTPD_USER} : 'apache';
my $group = ($ENV{HTTPD_GROUP}) ? $ENV{HTTPD_GROUP} : 'users';
print 'User '.$user;
print 'Group '.$group;
    
print 'MinSpareServers '.$ENV{APACHE_MIN_SERVERS} || '5';
print 'MaxSpareServers '.$ENV{APACHE_MAX_SERVERS} || '5';
print 'StartServers '.$ENV{APACHE_START_SERVERS} || '8';
print 'MaxClients '.$ENV{APACHE_MAX_CLIENTS} || '20';
print 'MaxRequestsPerChild '.$ENV{APACHE_MAX_REQUESTS} || '100';

print 'ServerAdmin "root"';

#
# pid/ directory
#
die "No log directory at $ENV{HTTPD_ROOT}/logs."
    unless -e "$ENV{HTTPD_ROOT}/logs";
print 'PidFile "logs/httpd.pid"';



( run in 0.644 second using v1.01-cache-2.11-cpan-437f7b0c052 )