1 package System::Introspector::Config;
5 has config => (is => 'lazy');
7 has config_file => (is => 'ro', required => 1);
11 my $reader = Config::General->new($self->config_file);
12 my %config = $reader->getall;
16 sub sudo_user { $_[0]->config->{sudo_user} }
18 sub groups { keys %{ $_[0]->config->{group} || {} } }
20 sub has_group { exists $_[0]->config->{group}{ $_[1] } }
22 my $_get_inherited = sub {
26 map { ($_ => $data->{$_}) }
27 grep { exists $data->{$_} }
31 sub config_for_group {
32 my ($self, $name) = @_;
34 my $config = $self->config;
35 %common = (%common, $config->$_get_inherited);
36 my $group = $config->{group}{ $name };
37 %common = (%common, $group->$_get_inherited);
43 %{ $group->{introspect}{ $_ } || {} },
45 } keys %{ $group->{introspect} || {} },