summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthieu <matthieu.cneude@gmail.com>2021-04-09 21:36:27 +0200
committermatthieu <matthieu.cneude@gmail.com>2021-04-09 21:36:27 +0200
commita2cb7859cc51200b589226f90a4f57c6c84973e1 (patch)
tree7c692999738bec4afdf6f7f6a8ede09c0e3dcd1b
parentfaea27ab923826a1fbb93b9abecc9a0719267840 (diff)
Fix some bugs
-rw-r--r--cmd/config.go16
-rw-r--r--cmd/root.go16
-rw-r--r--internal/github_widget.go3
-rw-r--r--internal/monitor_widget.go2
4 files changed, 29 insertions, 8 deletions
diff --git a/cmd/config.go b/cmd/config.go
index b2ceb9d..cb10caa 100644
--- a/cmd/config.go
+++ b/cmd/config.go
@@ -184,12 +184,26 @@ func mapConfig(cfgFile string) config {
tryReadFile(cfgFile)
}
- // viper.WatchConfig()
var cfg config
if err := viper.Unmarshal(&cfg); err != nil {
panic(err)
}
+ prefix := "DEVDASH"
+ for k, _ := range cfg.Projects {
+ if cfg.Projects[k].Services.GoogleAnalytics.Keyfile == "" {
+ cfg.Projects[k].Services.GoogleAnalytics.Keyfile = os.Getenv(prefix + "_GA_KEYFILE")
+ }
+
+ if cfg.Projects[k].Services.GoogleSearchConsole.Keyfile == "" {
+ cfg.Projects[k].Services.GoogleSearchConsole.Keyfile = os.Getenv(prefix + "_GSC_KEYFILE")
+ }
+
+ if cfg.Projects[k].Services.Github.Token == "" {
+ cfg.Projects[k].Services.Github.Token = os.Getenv(prefix + "_GITHUB_TOKEN")
+ }
+ }
+
return cfg
}
diff --git a/cmd/root.go b/cmd/root.go
index 9a4dde5..7357ae8 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -35,6 +35,7 @@ func init() {
// rootCmd.Flags().StringVarP(&logpath, "logpath", "l", "", "Path for logging")
rootCmd.Flags().BoolVarP(&debug, "debug", "d", false, "Debug Mode - doesn't display graph")
rootCmd.AddCommand(listCmd())
+ rootCmd.AddCommand(versionCmd())
}
func Execute() {
@@ -98,8 +99,9 @@ func build(file string, tui *internal.Tui) {
gaWidget, err := internal.NewGaWidget(gaService.Keyfile, gaService.ViewID)
if err != nil {
internal.DisplayError(tui, err)()
+ } else {
+ project.WithGa(gaWidget)
}
- project.WithGa(gaWidget)
}
gscService := p.Services.GoogleSearchConsole
@@ -107,8 +109,9 @@ func build(file string, tui *internal.Tui) {
gscWidget, err := internal.NewGscWidget(gscService.Keyfile, gscService.Address)
if err != nil {
internal.DisplayError(tui, err)()
+ } else {
+ project.WithGoogleSearchConsole(gscWidget)
}
- project.WithGoogleSearchConsole(gscWidget)
}
monService := p.Services.Monitor
@@ -116,8 +119,9 @@ func build(file string, tui *internal.Tui) {
monWidget, err := internal.NewMonitorWidget(monService.Address)
if err != nil {
internal.DisplayError(tui, err)()
+ } else {
+ project.WithMonitor(monWidget)
}
- project.WithMonitor(monWidget)
}
githubService := p.Services.Github
@@ -129,8 +133,9 @@ func build(file string, tui *internal.Tui) {
)
if err != nil {
internal.DisplayError(tui, err)()
+ } else {
+ project.WithGithub(githubWidget)
}
- project.WithGithub(githubWidget)
}
travisService := p.Services.TravisCI
@@ -160,8 +165,9 @@ func build(file string, tui *internal.Tui) {
if err != nil {
fmt.Println(err)
internal.DisplayError(tui, err)()
+ } else {
+ project.WithRemoteHost(remoteHostWidget)
}
- project.WithRemoteHost(remoteHostWidget)
}
localhost, err := internal.NewHostWidget("localhost", "localhost")
diff --git a/internal/github_widget.go b/internal/github_widget.go
index 3c74dfe..759c4cb 100644
--- a/internal/github_widget.go
+++ b/internal/github_widget.go
@@ -181,7 +181,7 @@ func (g *githubWidget) tableRepo(widget Widget) (f func() error, err error) {
order := "pushed"
if _, ok := widget.Options[optionOrder]; ok {
- order = widget.Options[optionRowLimit]
+ order = widget.Options[optionOrder]
}
rs, err := g.client.ListRepo(int(limit), order, metrics)
@@ -227,6 +227,7 @@ func (g *githubWidget) tableBranches(widget Widget) (f func() error, err error)
return
}
+// TODO can filter by open or close issue?
func (g *githubWidget) tableIssues(widget Widget) (f func() error, err error) {
var repo string
if _, ok := widget.Options[optionRepository]; ok {
diff --git a/internal/monitor_widget.go b/internal/monitor_widget.go
index 570ffd0..a69baf0 100644
--- a/internal/monitor_widget.go
+++ b/internal/monitor_widget.go
@@ -5,8 +5,8 @@ import (
"net/http"
"net/url"
+ goping "github.com/go-ping/ping"
"github.com/pkg/errors"
- goping "github.com/sparrc/go-ping"
)
const (