mhoppa commented on a change in pull request #3758: Rewrote
deliveryservice_stats to Go
URL: https://github.com/apache/trafficcontrol/pull/3758#discussion_r330253892
##########
File path: traffic_ops/traffic_ops_golang/config/config.go
##########
@@ -345,6 +371,43 @@ func GetLDAPConfig(LDAPConfPath string) (bool,
*ConfigLDAP, error) {
return true, LDAPconf, nil
}
+func GetInfluxConfig(path string) (bool, *ConfigInflux, error) {
+ raw, err := ioutil.ReadFile(path)
+ if err != nil {
+ return false, nil, fmt.Errorf("reading InfluxDB configuration
from '%s': %v", path, err)
+ }
+
+ c := ConfigInflux{}
+ if err := json.Unmarshal(raw, &c); err != nil {
+ return false, nil, fmt.Errorf("parsing InfluxDB configuration
from '%s': %v", path, err)
+ }
+
+ if c.User == "" {
+ return false, &c, errors.New("InfluxDB configuration missing a
username")
+ }
+
+ if c.Password == "" {
+ return false, &c, errors.New("InfluxDB configuration missing a
password")
+ }
+
+ if c.DSDBName == "" {
+ log.Warnln("InfluxDB configuration does not specify a DS stats
DB name - falling back on 'deliveryservice_stats'")
+ c.DSDBName = "deliveryservice_stats"
+ }
+
+ if c.CacheDBName == "" {
+ log.Warnln("InfluxDB configuration does not specify a Cache
Stats DB name - falling back on 'cache_stats'")
+ c.CacheDBName = "cache_stats"
+ }
+
+ if c.Secure == nil {
+ log.Warnln("InfluxDB configuration does not specify 'Secure',
defaulting to 'true'")
Review comment:
should be `secure` instead of `Secure`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services