summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhautoimport.pm9
1 files changed, 4 insertions, 5 deletions
diff --git a/rhautoimport.pm b/rhautoimport.pm
index 1af005f..06a0acc 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -34,13 +34,13 @@ use RHRD::rddb;
use RHRD::utils;
use JSON::MaybeXS;
use URI::QueryParam;
+use Net::Netrc;
use constant {
RD_USER => 'autoimport',
RHIMPORTD_WATCH_DIR => '/run/rhimportd/watch',
RHIMPORTD_TIMEOUT => 10,
- CBA_API_KEY => '/etc/cba-api.key'
};
sub report_title_and_last
@@ -105,12 +105,11 @@ sub fetch_parse_rss_cba
my ($url, $ua_str, $headers, $queries) = @_;
my $api_key = undef;
- if (open my $api_key_file, '<', CBA_API_KEY) {
- $api_key = <$api_key_file>;
- close $api_key_file;
+ my $machine = Net::Netrc->lookup('cba');
+ if (defined $machine) {
+ $api_key = $machine->password();
}
if (defined $api_key) {
- chomp $api_key;
if (defined $queries) {
$queries->{'c'} = $api_key;
} else {