mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Properly scope Config to the wtf package and remove it as a dependency from everywhere else
This commit is contained in:
@@ -3,13 +3,14 @@ package newrelic
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
nr "github.com/yfronto/newrelic"
|
||||
)
|
||||
|
||||
func Application() (*nr.Application, error) {
|
||||
client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY"))
|
||||
|
||||
application, err := client.GetApplication(Config.UInt("wtf.mods.newrelic.applicationId"))
|
||||
application, err := client.GetApplication(wtf.Config.UInt("wtf.mods.newrelic.applicationId"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -21,7 +22,7 @@ func Deployments() ([]nr.ApplicationDeployment, error) {
|
||||
client := nr.NewClient(os.Getenv("WTF_NEW_RELIC_API_KEY"))
|
||||
|
||||
opts := &nr.ApplicationDeploymentOptions{Page: 1}
|
||||
deployments, err := client.GetApplicationDeployments(Config.UInt("wtf.mods.newrelic.applicationId"), opts)
|
||||
deployments, err := client.GetApplicationDeployments(wtf.Config.UInt("wtf.mods.newrelic.applicationId"), opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,14 +3,10 @@ package newrelic
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
nr "github.com/yfronto/newrelic"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
}
|
||||
@@ -79,7 +75,7 @@ func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string {
|
||||
|
||||
revisions = append(revisions, deploy.Revision)
|
||||
|
||||
if len(revisions) == Config.UInt("wtf.mods.newrelic.deployCount", 5) {
|
||||
if len(revisions) == wtf.Config.UInt("wtf.mods.newrelic.deployCount", 5) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user