mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add env var defaults to AzureDevops module
This commit is contained in:
parent
2f9025ae2d
commit
bb10669b09
@ -3,6 +3,7 @@ package app
|
|||||||
import (
|
import (
|
||||||
"github.com/olebedev/config"
|
"github.com/olebedev/config"
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
|
"github.com/wtfutil/wtf/modules/azuredevops"
|
||||||
"github.com/wtfutil/wtf/modules/bamboohr"
|
"github.com/wtfutil/wtf/modules/bamboohr"
|
||||||
"github.com/wtfutil/wtf/modules/bargraph"
|
"github.com/wtfutil/wtf/modules/bargraph"
|
||||||
"github.com/wtfutil/wtf/modules/circleci"
|
"github.com/wtfutil/wtf/modules/circleci"
|
||||||
@ -14,7 +15,6 @@ import (
|
|||||||
"github.com/wtfutil/wtf/modules/datadog"
|
"github.com/wtfutil/wtf/modules/datadog"
|
||||||
"github.com/wtfutil/wtf/modules/digitalclock"
|
"github.com/wtfutil/wtf/modules/digitalclock"
|
||||||
"github.com/wtfutil/wtf/modules/docker"
|
"github.com/wtfutil/wtf/modules/docker"
|
||||||
"github.com/wtfutil/wtf/modules/azuredevops"
|
|
||||||
"github.com/wtfutil/wtf/modules/feedreader"
|
"github.com/wtfutil/wtf/modules/feedreader"
|
||||||
"github.com/wtfutil/wtf/modules/gcal"
|
"github.com/wtfutil/wtf/modules/gcal"
|
||||||
"github.com/wtfutil/wtf/modules/gerrit"
|
"github.com/wtfutil/wtf/modules/gerrit"
|
||||||
@ -80,6 +80,9 @@ func MakeWidget(
|
|||||||
case "arpansagovau":
|
case "arpansagovau":
|
||||||
settings := arpansagovau.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
settings := arpansagovau.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||||
widget = arpansagovau.NewWidget(app, settings)
|
widget = arpansagovau.NewWidget(app, settings)
|
||||||
|
case "azuredevops":
|
||||||
|
settings := azuredevops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||||
|
widget = azuredevops.NewWidget(app, pages, settings)
|
||||||
case "bamboohr":
|
case "bamboohr":
|
||||||
settings := bamboohr.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
settings := bamboohr.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||||
widget = bamboohr.NewWidget(app, settings)
|
widget = bamboohr.NewWidget(app, settings)
|
||||||
@ -113,9 +116,6 @@ func MakeWidget(
|
|||||||
case "docker":
|
case "docker":
|
||||||
settings := docker.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
settings := docker.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||||
widget = docker.NewWidget(app, pages, settings)
|
widget = docker.NewWidget(app, pages, settings)
|
||||||
case "azuredevops":
|
|
||||||
settings := azuredevops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
|
||||||
widget = azuredevops.NewWidget(app, pages, settings)
|
|
||||||
case "feedreader":
|
case "feedreader":
|
||||||
settings := feedreader.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
settings := feedreader.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||||
widget = feedreader.NewWidget(app, pages, settings)
|
widget = feedreader.NewWidget(app, pages, settings)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package azuredevops
|
package azuredevops
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/olebedev/config"
|
"github.com/olebedev/config"
|
||||||
"github.com/wtfutil/wtf/cfg"
|
"github.com/wtfutil/wtf/cfg"
|
||||||
)
|
)
|
||||||
@ -9,10 +11,11 @@ const defaultTitle = "azuredevops"
|
|||||||
|
|
||||||
// Settings defines the configuration options for this module
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
|
|
||||||
labelColor string
|
labelColor string
|
||||||
apiToken string
|
apiToken string `help:"Your Azure DevOps Access Token."`
|
||||||
orgURL string
|
orgURL string `help:"Your Azure DevOps organization URL."`
|
||||||
projectName string
|
projectName string
|
||||||
maxRows int
|
maxRows int
|
||||||
}
|
}
|
||||||
@ -20,11 +23,12 @@ type Settings struct {
|
|||||||
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, ymlConfig, globalConfig),
|
||||||
|
|
||||||
labelColor: ymlConfig.UString("labelColor", "white"),
|
labelColor: ymlConfig.UString("labelColor", "white"),
|
||||||
apiToken: ymlConfig.UString("apiToken", "api token not specified"),
|
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE DEVOPS_API_TOKEN")),
|
||||||
orgURL: ymlConfig.UString("orgURL", "org url not specified"),
|
orgURL: ymlConfig.UString("orgURL", os.Getenv("WTF_AZURE_DEVOPS_ORG_URL")),
|
||||||
projectName: ymlConfig.UString("projectName", "project name not specified"),
|
projectName: ymlConfig.UString("projectName", os.Getenv("WTF_AZURE_DEVOPS_PROJECT_NAME")),
|
||||||
maxRows: ymlConfig.UInt("maxRows", 3),
|
maxRows: ymlConfig.UInt("maxRows", 3),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ const defaultTitle = "Gitter"
|
|||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
|
|
||||||
apiToken string `help:"Your GitterPersonal Access Token."`
|
apiToken string `help:"Your Gitter Personal Access Token."`
|
||||||
numberOfMessages int `help:"Maximum number of (newest) messages to be displayed. Default is 10" optional:"true"`
|
numberOfMessages int `help:"Maximum number of (newest) messages to be displayed. Default is 10" optional:"true"`
|
||||||
roomURI string `help:"The room you want to display." values:"Example: wtfutil/Lobby"`
|
roomURI string `help:"The room you want to display." values:"Example: wtfutil/Lobby"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user