diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-08 00:51:37 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-08 00:51:37 (GMT) |
commit | 63db9233d681006b1b1fb4999825d21e79dfcec5 (patch) | |
tree | 0683ed60874493597cfd6e0b87fd2cb33c6f6ea1 /src/helsinki.at/rhimport/conf.go | |
parent | 92f96b74e3816214a65973b3b362424d110b3a77 (diff) |
move rddb to rhrd-go
Diffstat (limited to 'src/helsinki.at/rhimport/conf.go')
-rw-r--r-- | src/helsinki.at/rhimport/conf.go | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/helsinki.at/rhimport/conf.go b/src/helsinki.at/rhimport/conf.go index 2c91ed9..b7e8f88 100644 --- a/src/helsinki.at/rhimport/conf.go +++ b/src/helsinki.at/rhimport/conf.go @@ -24,10 +24,6 @@ package rhimport -import ( - "github.com/vaughan0/go-ini" -) - type ImportParamDefaults struct { Channels uint NormalizationLevel int @@ -36,44 +32,14 @@ type ImportParamDefaults struct { } type Config struct { - configfile string RDXportEndpoint string TempDir string - dbHost string - dbUser string - dbPasswd string - dbDb string LocalFetchDir string ImportParamDefaults } -func getIniValue(file ini.File, section string, key string, dflt string) string { - value, ok := file.Get(section, key) - if ok { - return value - } - return dflt -} - -func (self *Config) readConfigFile() error { - file, err := ini.LoadFile(self.configfile) - if err != nil { - return err - } - - self.dbHost = getIniValue(file, "mySQL", "Hostname", "localhost") - self.dbUser = getIniValue(file, "mySQL", "Loginname", "rivendell") - self.dbPasswd = getIniValue(file, "mySQL", "Password", "letmein") - self.dbDb = getIniValue(file, "mySQL", "Database", "rivendell") - return nil -} - -func NewConfig(configfile, rdxportEndpoint, tempDir, localFetchDir string) (conf *Config, err error) { +func NewConfig(rdxportEndpoint, tempDir, localFetchDir string) (conf *Config) { conf = new(Config) - conf.configfile = configfile - if err = conf.readConfigFile(); err != nil { - return - } conf.RDXportEndpoint = rdxportEndpoint conf.TempDir = tempDir conf.LocalFetchDir = localFetchDir |