summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhautoimport.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/rhautoimport.pm b/rhautoimport.pm
index a2b4c50..7c0fd50 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -33,6 +33,7 @@ use IO::Handle;
use LWP::Simple;
use XML::Feed;
use RHRD::rddb;
+use RHRD::utils;
use JSON::MaybeXS;
use URI::QueryParam;
@@ -40,7 +41,8 @@ use URI::QueryParam;
use constant {
RD_USER => 'autoimport',
RHIMPORTD_WATCH_DIR => '/run/rhimportd/watch',
- RHIMPORTD_TIMEOUT => 10
+ RHIMPORTD_TIMEOUT => 10,
+ CBA_API_KEY => '/etc/cba-api.key'
};
@@ -92,8 +94,13 @@ sub fetch_parse_rss_cba
{
my ($url, $ua_str, $headers, $queries) = @_;
- my $api_key = 'Kfs2IoV2Wmd'; # TODO: read this from config!!!
+ my $api_key = undef;
+ if (open my $api_key_file, '<', CBA_API_KEY) {
+ $api_key = <$api_key_file>;
+ close $api_key_file;
+ }
if (defined $api_key) {
+ chomp $api_key;
if (defined $queries) {
$queries->{'c'} = $api_key;
} else {