start of object::remote logging usage
[scpubgit/System-Introspector-Report.git] / lib / System / Introspector / Report / Config.pm
CommitLineData
499ebcdd 1package System::Introspector::Report::Config;
2use Moo;
3use Config::General;
4use Module::Runtime qw( use_module );
5
6has config_file => (is => 'ro', required => 1);
7has config => (is => 'lazy');
8
9sub _build_config {
10 my ($self) = @_;
11 return +{
12 Config::General->new($self->config_file)->getall,
13 };
14}
15
16sub report_types {
17 my ($self) = @_;
18 my $reports = $self->config->{report} || {};
19 return map {
20 [$_, $reports->{$_}];
21 } sort keys %$reports;
22}
23
24sub publishers {
25 my ($self, @override) = @_;
26 my $publish = $self->config->{publish} || {};
27 return map {
28 use_module("System::Introspector::Report::Publish::$_")
29 ->new($publish->{$_} || {});
30 } @override ? @override : sort keys %$publish;
31}
32
331;