Commit 3a6dedec authored by Mike Jones's avatar Mike Jones 馃尪
Browse files

Add IsPermittedStatType config method, remove InfluxDB connection for now

parent efc4a880
......@@ -32,8 +32,8 @@ func NewApplication() *StatPlat {
}
return &StatPlat{
Config: config,
InfluxDB: config.NewInfluxDB(),
Config: config,
//InfluxDB: config.NewInfluxDB(),
}
}
......@@ -42,7 +42,7 @@ func (s *StatPlat) NewPoint(input string) *Point {
r := regexp.MustCompile(`^(?P<Stat>\w+)(?P<Operation>[\+\-])(?P<Value>[\+\-\d]+)$`)
res := r.FindStringSubmatch(input)
if len(res) < 3 || res[3] == "0" || !s.Config.PermittedStatTypes[res[1]] {
if len(res) < 3 || res[3] == "0" || !s.Config.IsPermittedStatType(res[1]) {
return nil
}
......
......@@ -65,3 +65,9 @@ func NewConfig() (*Config, error) {
return c, err
}
// IsPermittedStatType validates whether a stat type is allowed by the current
// configuration
func (c *Config) IsPermittedStatType(inp string) bool {
return c.PermittedStatTypes[inp]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment