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 | 774e626114dace5435f5f21dc9957d5da996b3bb (patch) | |
tree | 79634d214fb05efdaba2bf7a9808f5b687d6e30b /conf.go | |
parent | 399f26ca052c09ed54f812343a33d82560d9ae48 (diff) |
improved coding style
Diffstat (limited to 'conf.go')
-rw-r--r-- | conf.go | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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 |