1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/modules/azuredevops/settings.go
Chris Cummer fa0d8761ae A few minor changes made while updating documentation
Signed-off-by: Chris Cummer <chriscummer@me.com>
2019-12-30 17:26:50 -05:00

40 lines
1.2 KiB
Go

package azuredevops
import (
"os"
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
const (
defaultFocus = false
defaultTitle = "azuredevops"
)
// Settings defines the configuration options for this module
type Settings struct {
common *cfg.Common
apiToken string `help:"Your Azure DevOps Access Token."`
labelColor string
maxRows int
orgURL string `help:"Your Azure DevOps organization URL."`
projectName string
}
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocus, ymlConfig, globalConfig),
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_AZURE_DEVOPS_API_TOKEN")),
labelColor: ymlConfig.UString("labelColor", "white"),
maxRows: ymlConfig.UInt("maxRows", 3),
orgURL: ymlConfig.UString("orgURL", os.Getenv("WTF_AZURE_DEVOPS_ORG_URL")),
projectName: ymlConfig.UString("projectName", os.Getenv("WTF_AZURE_DEVOPS_PROJECT_NAME")),
}
return &settings
}