package APKPM::Config;

use Moose::Role;

use File::Slurp;
use Data::Dump qw(dump);

our $config;

sub config {
	my ( $self, $name ) = @_;
	if ( ! $config ) {
		my $code = read_file '/opt/managment_tools/etc/config.pl';
		$code =~ s/\$(\w+)/\$config->{$1}/gs;
		$code =~ s/\@(\w+)/\@{\$config->{$1}}/gs;
		eval $code;
		die $@ if $@;
	}
	die "no $name in ",dump $config unless exists $config->{$name};
	return $config->{$name};
}

1;
