squash merge from dev branch

This commit is contained in:
Steve Brunton
2017-09-04 22:52:14 -04:00
parent 123cd935a3
commit ed916703c6
1058 changed files with 311598 additions and 3 deletions

32
exporter/config.go Normal file
View File

@@ -0,0 +1,32 @@
package exporter
import (
"fmt"
"go.uber.org/zap"
)
type Config struct {
Devices []Device
Logger *zap.SugaredLogger
Metrics PromMetrics
}
func (c *Config) FromFlags(device, address, user, password *string) error {
if *device == "" || *address == "" || *user == "" || *password == "" {
return fmt.Errorf("missing required param for single device configuration")
}
d := &Device{
Address: *address,
Name: *device,
User: *user,
Password: *password,
}
*c = Config{
Devices: []Device{*d},
}
return nil
}