diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 15:21:41 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 15:21:41 +0000 |
commit | c5083c05ff06811b88121a82916524bafab42418 (patch) | |
tree | 8f9bdbc55939d78137cc725978058b20f2d85bd4 /lib | |
parent | 0268da9024bc8b59551929983c967f9c5aaf6b0c (diff) | |
download | mgaadvisories-c5083c05ff06811b88121a82916524bafab42418.tar mgaadvisories-c5083c05ff06811b88121a82916524bafab42418.tar.gz mgaadvisories-c5083c05ff06811b88121a82916524bafab42418.tar.bz2 mgaadvisories-c5083c05ff06811b88121a82916524bafab42418.tar.xz mgaadvisories-c5083c05ff06811b88121a82916524bafab42418.zip |
Load config from home directory if file exists
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/Advisories.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index ac7a734..cda9528 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -12,10 +12,12 @@ use Email::Simple::Creator; my $config_file = '/usr/share/mga-advisories/config'; my $config = LoadFile($ENV{MGAADV_CONF} || $config_file); -my $etc_config_file = '/etc/mga-advisories.conf'; -my $etc_config = LoadFile($etc_config_file); -foreach my $k (keys %$etc_config) { - $config->{$k} = $etc_config->{$k}; +my $home_config_file = $ENV{HOME} . '/.mga-advisories/mga-advisories.conf'; +my $custom_config_file = -f $home_config_file ? $home_config_file + : '/etc/mga-advisories.conf'; +my $custom_config = LoadFile($custom_config_file); +foreach my $k (keys %$custom_config) { + $config->{$k} = $custom_config->{$k}; } my %basename = ( |