Skip to content

Commit

Permalink
dogstatsd default configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostec committed Sep 19, 2017
1 parent 82b65d1 commit b5d6d81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion reporters/dogstatsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ func MakeDogStatsD(config *viper.Viper, logger *logrus.Logger) {
}
}

func loadDefaultConfigs(c *viper.Viper) {
c.SetDefault("reporters.dogstatsd.host", "localhost:8125")
c.SetDefault("reporters.dogstatsd.prefix", "test.")
}

// NewDogStatsD creates a DogStatsD struct using host and prefix from config
func NewDogStatsD(config *viper.Viper, logger *logrus.Logger) (*DogStatsD, error) {
// handle non-existent host
loadDefaultConfigs(config)
host := config.GetString("reporters.dogstatsd.host")
prefix := config.GetString("reporters.dogstatsd.prefix")
c, err := dogstatsd.New(host, prefix)
Expand Down

0 comments on commit b5d6d81

Please sign in to comment.