From 5f1a1745610f854d2c828439f164354e3ab8ffb6 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Fri, 2 Sep 2016 04:17:41 +0200
Subject: youtube-dl fetches CBA api key from .netrc now


diff --git a/rhimport/core.go b/rhimport/core.go
index 12ad35c..25a4090 100644
--- a/rhimport/core.go
+++ b/rhimport/core.go
@@ -25,13 +25,11 @@
 package rhimport
 
 import (
-	"bufio"
 	"fmt"
 	"io/ioutil"
 	"log"
 	"os"
 	"path"
-	"strings"
 
 	"code.helsinki.at/rhrd-go/rddb"
 	"github.com/andelf/go-curl"
@@ -47,8 +45,6 @@ const (
 	ARCHIV_HOST      = "archiv.helsinki.at"
 	ARCHIV_USER      = "rhimport"
 	ARCHIV_BASE_PATH = "/srv/archiv"
-
-	CBA_API_KEY_FILE = "/etc/cba-api.key"
 )
 
 var (
@@ -110,16 +106,6 @@ func (p *FilePolicy) FromString(str string) error {
 	return nil
 }
 
-func getCBAApiKey() string {
-	key_file, err := os.Open(CBA_API_KEY_FILE)
-	if err == nil {
-		defer key_file.Close()
-		data, _ := bufio.NewReader(key_file).ReadString('\n')
-		return strings.TrimSpace(string(data))
-	}
-	return ""
-}
-
 type AttachmentChunk struct {
 	Data  []byte
 	Error error
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index db7ac3e..2740055 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -143,9 +143,6 @@ func checkYoutubeDL(ctx *Context, res *Result, uri *url.URL) *youtubeDLInfo {
 	var stderr, stdout bytes.Buffer
 	cmd.Stdout = &stdout
 	cmd.Stderr = &stderr
-	if cba_api_key := getCBAApiKey(); cba_api_key != "" {
-		cmd.Env = append(os.Environ(), "CBA_API_KEY="+cba_api_key)
-	}
 
 	ctx.stdlog.Printf("running youtube-dl for '%s'", ctx.SourceUri)
 	done := make(chan *youtubeDLInfo)
-- 
cgit v0.10.2