Mojo-Darkpan
view release on metacpan or search on metacpan
lib/Mojo/Darkpan/Config.pm view on Meta::CPAN
return $config;
}
sub _build__config {
my $self = shift;
my $location = $ENV{DARKPAN_CONFIG_FILE};
if (defined($location)) {
$self->_validateAssetLocation($location);
my $file = Mojo::File->new($location);
my $config = JSON->new->utf8->decode($file->slurp);
return $config;
}
return undef;
}
lib/Mojo/Darkpan/Config.pm view on Meta::CPAN
$dir = $ENV{DARKPAN_DIRECTORY};
}
else {
$dir = $self->_config->{directory}
if $self->_config && $self->_config->{directory};
}
# default if undef
$dir //= 'darkpan';
$dir = $self->_validateAssetLocation($dir);
return $dir;
}
sub _build_compressIndex {
my $self = shift;
my $compress;
if ($ENV{DARKPAN_COMPRESS_INDEX}) {
$compress = $ENV{DARKPAN_COMPRESS_INDEX};
}
lib/Mojo/Darkpan/Config.pm view on Meta::CPAN
$compress = $self->_config->{compress_index}
if $self->_config && $self->_config->{compress_index};
}
# default if undef
$compress //= 1;
return $compress;
}
sub _validateAssetLocation {
my $self = shift;
my $dir = shift;
if ($dir !~ m/^\//) {
$dir =~ s/^\.\///;
my $base = getcwd;
$dir = "$base/$dir";
}
return $dir;
( run in 1.628 second using v1.01-cache-2.11-cpan-f56aa216473 )