diff options
Diffstat (limited to 'rhimport/core.go')
-rw-r--r-- | rhimport/core.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/rhimport/core.go b/rhimport/core.go index ec184bb..9780485 100644 --- a/rhimport/core.go +++ b/rhimport/core.go @@ -52,10 +52,9 @@ const ( ) var ( - bool2str = map[bool]string{false: "0", true: "1"} - rhl = log.New(os.Stderr, "[rhimport]\t", log.LstdFlags) - rhdl = log.New(ioutil.Discard, "[rhimport-dbg]\t", log.LstdFlags) - cba_api_key = "" + bool2str = map[bool]string{false: "0", true: "1"} + rhl = log.New(os.Stderr, "[rhimport]\t", log.LstdFlags) + rhdl = log.New(ioutil.Discard, "[rhimport-dbg]\t", log.LstdFlags) ) func init() { @@ -63,13 +62,6 @@ func init() { rhdl.SetOutput(os.Stderr) } - key_file, err := os.Open(CBA_API_KEY_FILE) - if err == nil { - defer key_file.Close() - data, _ := bufio.NewReader(key_file).ReadString('\n') - cba_api_key = strings.TrimSpace(string(data)) - } - curl.GlobalInit(curl.GLOBAL_ALL) fetcherInit() } @@ -124,6 +116,16 @@ 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 Context struct { conf *Config db *rddb.DBChan |