Skip to content

Commit

Permalink
Added trimming to config to clean up any unwanted space characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed Aug 25, 2018
1 parent 6e87f93 commit 0212f48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
package config

import (
"strings"

"github.com/spf13/viper"
)

Expand Down Expand Up @@ -63,13 +65,13 @@ func LoadConfig() (*Config, error) {
return nil, err
}

conf.DbUser = v.GetString("DbUser")
conf.DbPassword = v.GetString("DbPassword")
conf.DbName = v.GetString("DbName")
conf.DbHost = v.GetString("DbHost")
conf.DbPort = v.GetString("DbPort")
conf.ListenHost = v.GetString("ListenHost")
conf.ListenPort = v.GetString("ListenPort")
conf.DbUser = strings.TrimSpace(v.GetString("DbUser"))
conf.DbPassword = strings.TrimSpace(v.GetString("DbPassword"))
conf.DbName = strings.TrimSpace(v.GetString("DbName"))
conf.DbHost = strings.TrimSpace(v.GetString("DbHost"))
conf.DbPort = strings.TrimSpace(v.GetString("DbPort"))
conf.ListenHost = strings.TrimSpace(v.GetString("ListenHost"))
conf.ListenPort = strings.TrimSpace(v.GetString("ListenPort"))

return conf, nil
}

0 comments on commit 0212f48

Please sign in to comment.