diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-07-19 22:06:13 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-07-19 22:06:13 (GMT) |
commit | c25ac2a14c402cbfec0e93674acb236d10033580 (patch) | |
tree | 0d5b25320d92cd0e32ad8d6d20241b6e91f0a691 | |
parent | c10b740439ddcdeb4fd475e113cc439f374fc96b (diff) |
read cba api key from file
-rw-r--r-- | rhautoimport.pm | 11 |
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 { |