diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-31 09:46:40 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-31 09:46:40 (GMT) |
commit | 0ef8fcb03fc4f51b8bc6b1a24f2e964b6a03d50c (patch) | |
tree | d065a87002893b693e17f2fe503a6f9631564c2b /src/helsinki.at/rhimport/conf.go | |
parent | 620d1b76807f6ecffda54347db7b58107d03c2a5 (diff) |
improved coding style
Diffstat (limited to 'src/helsinki.at/rhimport/conf.go')
-rw-r--r-- | src/helsinki.at/rhimport/conf.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/helsinki.at/rhimport/conf.go b/src/helsinki.at/rhimport/conf.go index 5f22782..d628563 100644 --- a/src/helsinki.at/rhimport/conf.go +++ b/src/helsinki.at/rhimport/conf.go @@ -39,15 +39,15 @@ type Config struct { configfile string RDXportEndpoint string TempDir string - db_host string - db_user string - db_passwd string - db_db string + dbHost string + dbUser string + dbPasswd string + dbDb string LocalFetchDir string ImportParamDefaults } -func get_ini_value(file ini.File, section string, key string, dflt string) string { +func getIniValue(file ini.File, section string, key string, dflt string) string { value, ok := file.Get(section, key) if ok { return value @@ -55,28 +55,28 @@ func get_ini_value(file ini.File, section string, key string, dflt string) strin return dflt } -func (self *Config) read_config_file() error { +func (self *Config) readConfigFile() error { file, err := ini.LoadFile(self.configfile) if err != nil { return err } - self.db_host = get_ini_value(file, "mySQL", "Hostname", "localhost") - self.db_user = get_ini_value(file, "mySQL", "Loginname", "rivendell") - self.db_passwd = get_ini_value(file, "mySQL", "Password", "letmein") - self.db_db = get_ini_value(file, "mySQL", "Database", "rivendell") + 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, rdxport_endpoint, temp_dir, local_fetch_dir *string) (conf *Config, err error) { +func NewConfig(configfile, rdxportEndpoint, tempDir, localFetchDir *string) (conf *Config, err error) { conf = new(Config) conf.configfile = *configfile - if err = conf.read_config_file(); err != nil { + if err = conf.readConfigFile(); err != nil { return } - conf.RDXportEndpoint = *rdxport_endpoint - conf.TempDir = *temp_dir - conf.LocalFetchDir = *local_fetch_dir + conf.RDXportEndpoint = *rdxportEndpoint + conf.TempDir = *tempDir + conf.LocalFetchDir = *localFetchDir conf.ImportParamDefaults.Channels = 2 conf.ImportParamDefaults.NormalizationLevel = -12 conf.ImportParamDefaults.AutotrimLevel = 0 |