aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--lib/MGA/Advisories.pm10
2 files changed, 7 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 16b8282..7b22f1b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
- add 'new' command to add a new advisory
- add 'list' command to list advisories
- add 'show' command to show an advisory
+- load config from home directory if file exists
Version 0.4
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 = (