You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rate-o-mat/t/Utils/Env.pm

32 lines
721 B

package Utils::Env;
use strict;
use warnings;
use Test::More;
use POSIX qw(tzset strftime);
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(
set_local_timezone
);
## no critic (Variables::RequireLocalizedPunctuationVars)
$ENV{RATEOMAT_BILLING_DB_HOST} //= '127.0.0.1';
$ENV{RATEOMAT_PROVISIONING_DB_HOST} //= '127.0.0.1';
$ENV{RATEOMAT_ACCOUNTING_DB_HOST} //= '127.0.0.1';
$ENV{CATALYST_SERVER} //= 'https://127.0.0.1:1443';
sub set_local_timezone {
(my $tz,$ENV{RATEOMAT_CONNECTION_TIMEZONE}) = @_;
if ($tz) {
my $old_tz = strftime("%Z", localtime());
$ENV{TZ} = $tz;
tzset;
diag("switching local timezone from $old_tz to " . strftime("%Z", localtime()));
}
}
1;