add function to read config from environment var
This commit is contained in:
parent
df5b04d857
commit
4c3fabf014
@ -127,6 +127,20 @@ sub get_qmail_map {
|
|||||||
return \%h;
|
return \%h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub from_environment {
|
||||||
|
my ($self, $config) = @_;
|
||||||
|
return unless $config;
|
||||||
|
|
||||||
|
my $env_name = "QPSMTPD_" . $config;
|
||||||
|
return unless $ENV{$env_name};
|
||||||
|
my @config;
|
||||||
|
push(@config, $ENV{$env_name});
|
||||||
|
|
||||||
|
|
||||||
|
return wantarray ? @config : $config[0];
|
||||||
|
}
|
||||||
|
|
||||||
sub from_file {
|
sub from_file {
|
||||||
my ($self, $config, $file, $visited) = @_;
|
my ($self, $config, $file, $visited) = @_;
|
||||||
$file ||= $self->config_dir($config) . "/$config";
|
$file ||= $self->config_dir($config) . "/$config";
|
||||||
|
Loading…
Reference in New Issue
Block a user