From c25ac2a14c402cbfec0e93674acb236d10033580 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 20 Jul 2016 00:06:13 +0200 Subject: read cba api key from file 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 { -- cgit v0.10.2