add function to read config from environment var

This commit is contained in:
Dominik Meyer 2025-02-01 21:24:38 +01:00
parent df5b04d857
commit 4c3fabf014
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -127,6 +127,20 @@ sub get_qmail_map {
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 {
my ($self, $config, $file, $visited) = @_;
$file ||= $self->config_dir($config) . "/$config";