mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Decouple modules from global config
Rather than referencing wtc.Config, instead pass the global config Also, look up config for the module early and pass that in sooner, to deal with fewer long paths and get rid of the ConfigKey variable
This commit is contained in:
parent
b310dcd69e
commit
5abd701b40
@ -26,7 +26,6 @@ type Colors struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
ConfigKey string
|
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,53 +60,51 @@ type Common struct {
|
|||||||
focusChar int
|
focusChar int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCommonSettingsFromYAML(name, configKey string, ymlConfig *config.Config) *Common {
|
func NewCommonSettingsFromModule(name string, moduleConfig *config.Config, globalSettings *config.Config) *Common {
|
||||||
colorsPath := "wtf.colors"
|
colorsConfig, _ := globalSettings.Get("wtf.colors")
|
||||||
modulePath := "wtf.mods." + configKey
|
positionPath := "position"
|
||||||
positionPath := "wtf.mods." + configKey + ".position"
|
|
||||||
sigilsPath := "wtf.sigils"
|
sigilsPath := "wtf.sigils"
|
||||||
|
|
||||||
common := Common{
|
common := Common{
|
||||||
Colors: Colors{
|
Colors: Colors{
|
||||||
Background: ymlConfig.UString(modulePath+".background", ymlConfig.UString(colorsPath+".background", "black")),
|
Background: moduleConfig.UString("background", globalSettings.UString("background", "black")),
|
||||||
BorderFocusable: ymlConfig.UString(colorsPath+".border.focusable", "red"),
|
BorderFocusable: colorsConfig.UString("border.focusable", "red"),
|
||||||
BorderFocused: ymlConfig.UString(colorsPath+".border.focused", "orange"),
|
BorderFocused: colorsConfig.UString("border.focused", "orange"),
|
||||||
BorderNormal: ymlConfig.UString(colorsPath+".border.normal", "gray"),
|
BorderNormal: colorsConfig.UString("border.normal", "gray"),
|
||||||
Checked: ymlConfig.UString(colorsPath+".checked", "white"),
|
Checked: colorsConfig.UString("checked", "white"),
|
||||||
Foreground: ymlConfig.UString(modulePath+".foreground", ymlConfig.UString(colorsPath+".foreground", "white")),
|
Foreground: moduleConfig.UString("foreground", colorsConfig.UString("foreground", "white")),
|
||||||
HighlightFore: ymlConfig.UString(colorsPath+".highlight.fore", "black"),
|
HighlightFore: colorsConfig.UString("highlight.fore", "black"),
|
||||||
HighlightBack: ymlConfig.UString(colorsPath+".highlight.back", "green"),
|
HighlightBack: colorsConfig.UString("highlight.back", "green"),
|
||||||
Text: ymlConfig.UString(modulePath+".colors.text", ymlConfig.UString(colorsPath+".text", "white")),
|
Text: moduleConfig.UString("colors.text", colorsConfig.UString("text", "white")),
|
||||||
Title: ymlConfig.UString(modulePath+".colors.title", ymlConfig.UString(colorsPath+".title", "white")),
|
Title: moduleConfig.UString("colors.title", colorsConfig.UString("title", "white")),
|
||||||
},
|
},
|
||||||
|
|
||||||
Module: Module{
|
Module: Module{
|
||||||
ConfigKey: configKey,
|
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
|
|
||||||
Position: Position{
|
Position: Position{
|
||||||
Height: ymlConfig.UInt(positionPath + ".height"),
|
Height: moduleConfig.UInt(positionPath + ".height"),
|
||||||
Left: ymlConfig.UInt(positionPath + ".left"),
|
Left: moduleConfig.UInt(positionPath + ".left"),
|
||||||
Top: ymlConfig.UInt(positionPath + ".top"),
|
Top: moduleConfig.UInt(positionPath + ".top"),
|
||||||
Width: ymlConfig.UInt(positionPath + ".width"),
|
Width: moduleConfig.UInt(positionPath + ".width"),
|
||||||
},
|
},
|
||||||
|
|
||||||
Enabled: ymlConfig.UBool(modulePath+".enabled", false),
|
Enabled: moduleConfig.UBool("enabled", false),
|
||||||
RefreshInterval: ymlConfig.UInt(modulePath+".refreshInterval", 300),
|
RefreshInterval: moduleConfig.UInt("refreshInterval", 300),
|
||||||
Title: ymlConfig.UString(modulePath+".title", name),
|
Title: moduleConfig.UString("title", name),
|
||||||
|
|
||||||
focusChar: ymlConfig.UInt(modulePath+".focusChar", -1),
|
focusChar: moduleConfig.UInt("focusChar", -1),
|
||||||
}
|
}
|
||||||
|
|
||||||
common.Colors.Rows.Even = ymlConfig.UString(modulePath+".colors.rows.even", ymlConfig.UString(colorsPath+".rows.even", "white"))
|
common.Colors.Rows.Even = moduleConfig.UString("colors.rows.even", moduleConfig.UString("rows.even", "white"))
|
||||||
common.Colors.Rows.Odd = ymlConfig.UString(modulePath+".colors.rows.even", ymlConfig.UString(colorsPath+".rows.odd", "lightblue"))
|
common.Colors.Rows.Odd = moduleConfig.UString("colors.rows.even", moduleConfig.UString("rows.odd", "lightblue"))
|
||||||
|
|
||||||
common.Sigils.Checkbox.Checked = ymlConfig.UString(sigilsPath+".Checkbox.Checked", "x")
|
common.Sigils.Checkbox.Checked = globalSettings.UString(sigilsPath+".Checkbox.Checked", "x")
|
||||||
common.Sigils.Checkbox.Unchecked = ymlConfig.UString(sigilsPath+".Checkbox.Unchecked", " ")
|
common.Sigils.Checkbox.Unchecked = globalSettings.UString(sigilsPath+".Checkbox.Unchecked", " ")
|
||||||
|
|
||||||
common.Sigils.Paging.Normal = ymlConfig.UString(sigilsPath+".Paging.Normal", ymlConfig.UString("wtf.paging.pageSigil", "*"))
|
common.Sigils.Paging.Normal = globalSettings.UString(sigilsPath+".Paging.Normal", globalSettings.UString("wtf.paging.pageSigil", "*"))
|
||||||
common.Sigils.Paging.Selected = ymlConfig.UString(sigilsPath+".Paging.Select", ymlConfig.UString("wtf.paging.selectedSigil", "_"))
|
common.Sigils.Paging.Selected = globalSettings.UString(sigilsPath+".Paging.Select", globalSettings.UString("wtf.paging.selectedSigil", "_"))
|
||||||
|
|
||||||
return &common
|
return &common
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -52,147 +52,153 @@ import (
|
|||||||
"github.com/wtfutil/wtf/wtf"
|
"github.com/wtfutil/wtf/wtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MakeWidget(app *tview.Application, pages *tview.Pages, widgetName string) wtf.Wtfable {
|
func MakeWidget(
|
||||||
|
app *tview.Application,
|
||||||
|
pages *tview.Pages,
|
||||||
|
widgetName string,
|
||||||
|
moduleConfig *config.Config,
|
||||||
|
globalConfig *config.Config,
|
||||||
|
) wtf.Wtfable {
|
||||||
var widget wtf.Wtfable
|
var widget wtf.Wtfable
|
||||||
|
|
||||||
// Always in alphabetical order
|
// Always in alphabetical order
|
||||||
switch widgetName {
|
switch widgetName {
|
||||||
case "bamboohr":
|
case "bamboohr":
|
||||||
settings := bamboohr.NewSettingsFromYAML("BambooHR", wtf.Config)
|
settings := bamboohr.NewSettingsFromYAML("BambooHR", moduleConfig, globalConfig)
|
||||||
widget = bamboohr.NewWidget(app, settings)
|
widget = bamboohr.NewWidget(app, settings)
|
||||||
case "bargraph":
|
case "bargraph":
|
||||||
widget = bargraph.NewWidget(app)
|
widget = bargraph.NewWidget(app)
|
||||||
case "bittrex":
|
case "bittrex":
|
||||||
settings := bittrex.NewSettingsFromYAML("Bittrex", wtf.Config)
|
settings := bittrex.NewSettingsFromYAML("Bittrex", moduleConfig, globalConfig)
|
||||||
widget = bittrex.NewWidget(app, settings)
|
widget = bittrex.NewWidget(app, settings)
|
||||||
case "blockfolio":
|
case "blockfolio":
|
||||||
settings := blockfolio.NewSettingsFromYAML("Blockfolio", wtf.Config)
|
settings := blockfolio.NewSettingsFromYAML("Blockfolio", moduleConfig, globalConfig)
|
||||||
widget = blockfolio.NewWidget(app, settings)
|
widget = blockfolio.NewWidget(app, settings)
|
||||||
case "circleci":
|
case "circleci":
|
||||||
settings := circleci.NewSettingsFromYAML("CircleCI", wtf.Config)
|
settings := circleci.NewSettingsFromYAML("CircleCI", moduleConfig, globalConfig)
|
||||||
widget = circleci.NewWidget(app, settings)
|
widget = circleci.NewWidget(app, settings)
|
||||||
case "clocks":
|
case "clocks":
|
||||||
settings := clocks.NewSettingsFromYAML("Clocks", wtf.Config)
|
settings := clocks.NewSettingsFromYAML("Clocks", moduleConfig, globalConfig)
|
||||||
widget = clocks.NewWidget(app, settings)
|
widget = clocks.NewWidget(app, settings)
|
||||||
case "cmdrunner":
|
case "cmdrunner":
|
||||||
settings := cmdrunner.NewSettingsFromYAML("CmdRunner", wtf.Config)
|
settings := cmdrunner.NewSettingsFromYAML("CmdRunner", moduleConfig, globalConfig)
|
||||||
widget = cmdrunner.NewWidget(app, settings)
|
widget = cmdrunner.NewWidget(app, settings)
|
||||||
case "cryptolive":
|
case "cryptolive":
|
||||||
settings := cryptolive.NewSettingsFromYAML("CryptoLive", wtf.Config)
|
settings := cryptolive.NewSettingsFromYAML("CryptoLive", moduleConfig, globalConfig)
|
||||||
widget = cryptolive.NewWidget(app, settings)
|
widget = cryptolive.NewWidget(app, settings)
|
||||||
case "datadog":
|
case "datadog":
|
||||||
settings := datadog.NewSettingsFromYAML("DataDog", wtf.Config)
|
settings := datadog.NewSettingsFromYAML("DataDog", moduleConfig, globalConfig)
|
||||||
widget = datadog.NewWidget(app, settings)
|
widget = datadog.NewWidget(app, settings)
|
||||||
case "gcal":
|
case "gcal":
|
||||||
settings := gcal.NewSettingsFromYAML("Calendar", wtf.Config)
|
settings := gcal.NewSettingsFromYAML("Calendar", moduleConfig, globalConfig)
|
||||||
widget = gcal.NewWidget(app, settings)
|
widget = gcal.NewWidget(app, settings)
|
||||||
case "gerrit":
|
case "gerrit":
|
||||||
settings := gerrit.NewSettingsFromYAML("Gerrit", wtf.Config)
|
settings := gerrit.NewSettingsFromYAML("Gerrit", moduleConfig, globalConfig)
|
||||||
widget = gerrit.NewWidget(app, pages, settings)
|
widget = gerrit.NewWidget(app, pages, settings)
|
||||||
case "git":
|
case "git":
|
||||||
settings := git.NewSettingsFromYAML("Git", wtf.Config)
|
settings := git.NewSettingsFromYAML("Git", moduleConfig, globalConfig)
|
||||||
widget = git.NewWidget(app, pages, settings)
|
widget = git.NewWidget(app, pages, settings)
|
||||||
case "github":
|
case "github":
|
||||||
settings := github.NewSettingsFromYAML("GitHub", wtf.Config)
|
settings := github.NewSettingsFromYAML("GitHub", moduleConfig, globalConfig)
|
||||||
widget = github.NewWidget(app, pages, settings)
|
widget = github.NewWidget(app, pages, settings)
|
||||||
case "gitlab":
|
case "gitlab":
|
||||||
settings := gitlab.NewSettingsFromYAML("GitLab", wtf.Config)
|
settings := gitlab.NewSettingsFromYAML("GitLab", moduleConfig, globalConfig)
|
||||||
widget = gitlab.NewWidget(app, pages, settings)
|
widget = gitlab.NewWidget(app, pages, settings)
|
||||||
case "gitter":
|
case "gitter":
|
||||||
settings := gitter.NewSettingsFromYAML("Gitter", wtf.Config)
|
settings := gitter.NewSettingsFromYAML("Gitter", moduleConfig, globalConfig)
|
||||||
widget = gitter.NewWidget(app, pages, settings)
|
widget = gitter.NewWidget(app, pages, settings)
|
||||||
case "gspreadsheets":
|
case "gspreadsheets":
|
||||||
settings := gspreadsheets.NewSettingsFromYAML("Google Spreadsheets", wtf.Config)
|
settings := gspreadsheets.NewSettingsFromYAML("Google Spreadsheets", moduleConfig, globalConfig)
|
||||||
widget = gspreadsheets.NewWidget(app, settings)
|
widget = gspreadsheets.NewWidget(app, settings)
|
||||||
case "hackernews":
|
case "hackernews":
|
||||||
settings := hackernews.NewSettingsFromYAML("HackerNews", wtf.Config)
|
settings := hackernews.NewSettingsFromYAML("HackerNews", moduleConfig, globalConfig)
|
||||||
widget = hackernews.NewWidget(app, pages, settings)
|
widget = hackernews.NewWidget(app, pages, settings)
|
||||||
case "ipapi":
|
case "ipapi":
|
||||||
settings := ipapi.NewSettingsFromYAML("IPAPI", wtf.Config)
|
settings := ipapi.NewSettingsFromYAML("IPAPI", moduleConfig, globalConfig)
|
||||||
widget = ipapi.NewWidget(app, settings)
|
widget = ipapi.NewWidget(app, settings)
|
||||||
case "ipinfo":
|
case "ipinfo":
|
||||||
settings := ipinfo.NewSettingsFromYAML("IPInfo", wtf.Config)
|
settings := ipinfo.NewSettingsFromYAML("IPInfo", moduleConfig, globalConfig)
|
||||||
widget = ipinfo.NewWidget(app, settings)
|
widget = ipinfo.NewWidget(app, settings)
|
||||||
case "jenkins":
|
case "jenkins":
|
||||||
settings := jenkins.NewSettingsFromYAML("Jenkins", wtf.Config)
|
settings := jenkins.NewSettingsFromYAML("Jenkins", moduleConfig, globalConfig)
|
||||||
widget = jenkins.NewWidget(app, pages, settings)
|
widget = jenkins.NewWidget(app, pages, settings)
|
||||||
case "jira":
|
case "jira":
|
||||||
settings := jira.NewSettingsFromYAML("Jira", wtf.Config)
|
settings := jira.NewSettingsFromYAML("Jira", moduleConfig, globalConfig)
|
||||||
widget = jira.NewWidget(app, pages, settings)
|
widget = jira.NewWidget(app, pages, settings)
|
||||||
case "logger":
|
case "logger":
|
||||||
settings := logger.NewSettingsFromYAML("Log", wtf.Config)
|
settings := logger.NewSettingsFromYAML("Log", moduleConfig, globalConfig)
|
||||||
widget = logger.NewWidget(app, settings)
|
widget = logger.NewWidget(app, settings)
|
||||||
case "mercurial":
|
case "mercurial":
|
||||||
settings := mercurial.NewSettingsFromYAML("Mercurial", wtf.Config)
|
settings := mercurial.NewSettingsFromYAML("Mercurial", moduleConfig, globalConfig)
|
||||||
widget = mercurial.NewWidget(app, pages, settings)
|
widget = mercurial.NewWidget(app, pages, settings)
|
||||||
case "nbascore":
|
case "nbascore":
|
||||||
settings := nbascore.NewSettingsFromYAML("NBA Score", wtf.Config)
|
settings := nbascore.NewSettingsFromYAML("NBA Score", moduleConfig, globalConfig)
|
||||||
widget = nbascore.NewWidget(app, pages, settings)
|
widget = nbascore.NewWidget(app, pages, settings)
|
||||||
case "newrelic":
|
case "newrelic":
|
||||||
settings := newrelic.NewSettingsFromYAML("NewRelic", wtf.Config)
|
settings := newrelic.NewSettingsFromYAML("NewRelic", moduleConfig, globalConfig)
|
||||||
widget = newrelic.NewWidget(app, settings)
|
widget = newrelic.NewWidget(app, settings)
|
||||||
case "opsgenie":
|
case "opsgenie":
|
||||||
settings := opsgenie.NewSettingsFromYAML("OpsGenie", wtf.Config)
|
settings := opsgenie.NewSettingsFromYAML("OpsGenie", moduleConfig, globalConfig)
|
||||||
widget = opsgenie.NewWidget(app, settings)
|
widget = opsgenie.NewWidget(app, settings)
|
||||||
case "pagerduty":
|
case "pagerduty":
|
||||||
settings := pagerduty.NewSettingsFromYAML("PagerDuty", wtf.Config)
|
settings := pagerduty.NewSettingsFromYAML("PagerDuty", moduleConfig, globalConfig)
|
||||||
widget = pagerduty.NewWidget(app, settings)
|
widget = pagerduty.NewWidget(app, settings)
|
||||||
case "power":
|
case "power":
|
||||||
settings := power.NewSettingsFromYAML("Power", wtf.Config)
|
settings := power.NewSettingsFromYAML("Power", moduleConfig, globalConfig)
|
||||||
widget = power.NewWidget(app, settings)
|
widget = power.NewWidget(app, settings)
|
||||||
case "prettyweather":
|
case "prettyweather":
|
||||||
settings := prettyweather.NewSettingsFromYAML("Pretty Weather", wtf.Config)
|
settings := prettyweather.NewSettingsFromYAML("Pretty Weather", moduleConfig, globalConfig)
|
||||||
widget = prettyweather.NewWidget(app, settings)
|
widget = prettyweather.NewWidget(app, settings)
|
||||||
case "resourceusage":
|
case "resourceusage":
|
||||||
settings := resourceusage.NewSettingsFromYAML("Resource Usage", wtf.Config)
|
settings := resourceusage.NewSettingsFromYAML("Resource Usage", moduleConfig, globalConfig)
|
||||||
widget = resourceusage.NewWidget(app, settings)
|
widget = resourceusage.NewWidget(app, settings)
|
||||||
case "rollbar":
|
case "rollbar":
|
||||||
settings := rollbar.NewSettingsFromYAML("Rollbar", wtf.Config)
|
settings := rollbar.NewSettingsFromYAML("Rollbar", moduleConfig, globalConfig)
|
||||||
widget = rollbar.NewWidget(app, pages, settings)
|
widget = rollbar.NewWidget(app, pages, settings)
|
||||||
case "security":
|
case "security":
|
||||||
settings := security.NewSettingsFromYAML("Security", wtf.Config)
|
settings := security.NewSettingsFromYAML("Security", moduleConfig, globalConfig)
|
||||||
widget = security.NewWidget(app, settings)
|
widget = security.NewWidget(app, settings)
|
||||||
case "spotify":
|
case "spotify":
|
||||||
settings := spotify.NewSettingsFromYAML("Spotify", wtf.Config)
|
settings := spotify.NewSettingsFromYAML("Spotify", moduleConfig, globalConfig)
|
||||||
widget = spotify.NewWidget(app, pages, settings)
|
widget = spotify.NewWidget(app, pages, settings)
|
||||||
case "spotifyweb":
|
case "spotifyweb":
|
||||||
settings := spotifyweb.NewSettingsFromYAML("Spotify Web", wtf.Config)
|
settings := spotifyweb.NewSettingsFromYAML("Spotify Web", moduleConfig, globalConfig)
|
||||||
widget = spotifyweb.NewWidget(app, pages, settings)
|
widget = spotifyweb.NewWidget(app, pages, settings)
|
||||||
case "status":
|
case "status":
|
||||||
settings := status.NewSettingsFromYAML("Status", wtf.Config)
|
settings := status.NewSettingsFromYAML("Status", moduleConfig, globalConfig)
|
||||||
widget = status.NewWidget(app, settings)
|
widget = status.NewWidget(app, settings)
|
||||||
// case "system":
|
// case "system":
|
||||||
// settings := system.NewSettingsFromYAML("System", wtf.Config)
|
// settings := system.NewSettingsFromYAML("System", moduleConfig, globalConfig)
|
||||||
// widget = system.NewWidget(app, date, version, settings)
|
// widget = system.NewWidget(app, date, version, settings)
|
||||||
case "textfile":
|
case "textfile":
|
||||||
settings := textfile.NewSettingsFromYAML("Textfile", wtf.Config)
|
settings := textfile.NewSettingsFromYAML("Textfile", moduleConfig, globalConfig)
|
||||||
widget = textfile.NewWidget(app, pages, settings)
|
widget = textfile.NewWidget(app, pages, settings)
|
||||||
case "todo":
|
case "todo":
|
||||||
settings := todo.NewSettingsFromYAML("Todo", wtf.Config)
|
settings := todo.NewSettingsFromYAML("Todo", moduleConfig, globalConfig)
|
||||||
widget = todo.NewWidget(app, pages, settings)
|
widget = todo.NewWidget(app, pages, settings)
|
||||||
case "todoist":
|
case "todoist":
|
||||||
settings := todoist.NewSettingsFromYAML("Todoist", wtf.Config)
|
settings := todoist.NewSettingsFromYAML("Todoist", moduleConfig, globalConfig)
|
||||||
widget = todoist.NewWidget(app, pages, settings)
|
widget = todoist.NewWidget(app, pages, settings)
|
||||||
case "travisci":
|
case "travisci":
|
||||||
settings := travisci.NewSettingsFromYAML("TravisCI", wtf.Config)
|
settings := travisci.NewSettingsFromYAML("TravisCI", moduleConfig, globalConfig)
|
||||||
widget = travisci.NewWidget(app, pages, settings)
|
widget = travisci.NewWidget(app, pages, settings)
|
||||||
case "trello":
|
case "trello":
|
||||||
settings := trello.NewSettingsFromYAML("Trello", wtf.Config)
|
settings := trello.NewSettingsFromYAML("Trello", moduleConfig, globalConfig)
|
||||||
widget = trello.NewWidget(app, settings)
|
widget = trello.NewWidget(app, settings)
|
||||||
case "twitter":
|
case "twitter":
|
||||||
settings := twitter.NewSettingsFromYAML("Twitter", wtf.Config)
|
settings := twitter.NewSettingsFromYAML("Twitter", moduleConfig, globalConfig)
|
||||||
widget = twitter.NewWidget(app, pages, settings)
|
widget = twitter.NewWidget(app, pages, settings)
|
||||||
case "victorops":
|
case "victorops":
|
||||||
settings := victorops.NewSettingsFromYAML("VictorOps - OnCall", wtf.Config)
|
settings := victorops.NewSettingsFromYAML("VictorOps - OnCall", moduleConfig, globalConfig)
|
||||||
widget = victorops.NewWidget(app, settings)
|
widget = victorops.NewWidget(app, settings)
|
||||||
case "weather":
|
case "weather":
|
||||||
settings := weather.NewSettingsFromYAML("Weather", wtf.Config)
|
settings := weather.NewSettingsFromYAML("Weather", moduleConfig, globalConfig)
|
||||||
widget = weather.NewWidget(app, pages, settings)
|
widget = weather.NewWidget(app, pages, settings)
|
||||||
case "zendesk":
|
case "zendesk":
|
||||||
settings := zendesk.NewSettingsFromYAML("Zendesk", wtf.Config)
|
settings := zendesk.NewSettingsFromYAML("Zendesk", moduleConfig, globalConfig)
|
||||||
widget = zendesk.NewWidget(app, settings)
|
widget = zendesk.NewWidget(app, settings)
|
||||||
default:
|
default:
|
||||||
settings := unknown.NewSettingsFromYAML(widgetName, wtf.Config)
|
settings := unknown.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||||
widget = unknown.NewWidget(app, widgetName, settings)
|
widget = unknown.NewWidget(app, widgetName, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +211,9 @@ func MakeWidgets(app *tview.Application, pages *tview.Pages, config *config.Conf
|
|||||||
mods, _ := config.Map("wtf.mods")
|
mods, _ := config.Map("wtf.mods")
|
||||||
|
|
||||||
for mod := range mods {
|
for mod := range mods {
|
||||||
if enabled := config.UBool("wtf.mods."+mod+".enabled", false); enabled {
|
modConfig, _ := config.Get("wtf.mods." + mod)
|
||||||
widget := MakeWidget(app, pages, mod)
|
if enabled := modConfig.UBool("enabled", false); enabled {
|
||||||
|
widget := MakeWidget(app, pages, mod, modConfig, config)
|
||||||
widgets = append(widgets, widget)
|
widgets = append(widgets, widget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,13 @@ type Settings struct {
|
|||||||
subdomain string
|
subdomain string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_BAMBOO_HR_TOKEN")),
|
||||||
subdomain: localConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
subdomain: ymlConfig.UString("subdomain", os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN")),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -15,13 +15,12 @@ type Settings struct {
|
|||||||
apiKey string
|
apiKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_CIRCLE_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_CIRCLE_API_KEY")),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -25,20 +25,19 @@ type Settings struct {
|
|||||||
sort string
|
sort string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
dateFormat: localConfig.UString("dateFormat", wtf.SimpleDateFormat),
|
dateFormat: ymlConfig.UString("dateFormat", wtf.SimpleDateFormat),
|
||||||
timeFormat: localConfig.UString("timeFormat", wtf.SimpleTimeFormat),
|
timeFormat: ymlConfig.UString("timeFormat", wtf.SimpleTimeFormat),
|
||||||
locations: localConfig.UMap("locations"),
|
locations: ymlConfig.UMap("locations"),
|
||||||
sort: localConfig.UString("sort"),
|
sort: ymlConfig.UString("sort"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.rows.even = localConfig.UString("colors.rows.even", "white")
|
settings.colors.rows.even = ymlConfig.UString("colors.rows.even", "white")
|
||||||
settings.colors.rows.odd = localConfig.UString("colors.rows.odd", "blue")
|
settings.colors.rows.odd = ymlConfig.UString("colors.rows.odd", "blue")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,13 @@ type Settings struct {
|
|||||||
cmd string
|
cmd string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
args: wtf.ToStrs(localConfig.UList("args")),
|
args: wtf.ToStrs(ymlConfig.UList("args")),
|
||||||
cmd: localConfig.UString("cmd"),
|
cmd: ymlConfig.UString("cmd"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -34,22 +34,21 @@ type Settings struct {
|
|||||||
summary
|
summary
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.base.name = localConfig.UString("colors.base.name")
|
settings.colors.base.name = ymlConfig.UString("colors.base.name")
|
||||||
settings.colors.base.displayName = localConfig.UString("colors.base.displayName")
|
settings.colors.base.displayName = ymlConfig.UString("colors.base.displayName")
|
||||||
|
|
||||||
settings.colors.market.name = localConfig.UString("colors.market.name")
|
settings.colors.market.name = ymlConfig.UString("colors.market.name")
|
||||||
settings.colors.market.field = localConfig.UString("colors.market.field")
|
settings.colors.market.field = ymlConfig.UString("colors.market.field")
|
||||||
settings.colors.market.value = localConfig.UString("colors.market.value")
|
settings.colors.market.value = ymlConfig.UString("colors.market.value")
|
||||||
|
|
||||||
settings.summary.currencies = make(map[string]*currency)
|
settings.summary.currencies = make(map[string]*currency)
|
||||||
for key, val := range localConfig.UMap("summary") {
|
for key, val := range ymlConfig.UMap("summary") {
|
||||||
coercedVal := val.(map[string]interface{})
|
coercedVal := val.(map[string]interface{})
|
||||||
|
|
||||||
currency := ¤cy{
|
currency := ¤cy{
|
||||||
|
@ -21,14 +21,13 @@ type Settings struct {
|
|||||||
displayHoldings bool
|
displayHoldings bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
deviceToken: localConfig.UString("device_token"),
|
deviceToken: ymlConfig.UString("device_token"),
|
||||||
displayHoldings: localConfig.UBool("displayHoldings", true),
|
displayHoldings: ymlConfig.UBool("displayHoldings", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -40,29 +40,28 @@ type Settings struct {
|
|||||||
currencies map[string]*currency
|
currencies map[string]*currency
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.from.name = localConfig.UString("colors.from.name")
|
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||||
settings.colors.from.displayName = localConfig.UString("colors.from.displayName")
|
settings.colors.from.displayName = ymlConfig.UString("colors.from.displayName")
|
||||||
|
|
||||||
settings.colors.to.name = localConfig.UString("colors.to.name")
|
settings.colors.to.name = ymlConfig.UString("colors.to.name")
|
||||||
settings.colors.to.price = localConfig.UString("colors.to.price")
|
settings.colors.to.price = ymlConfig.UString("colors.to.price")
|
||||||
|
|
||||||
settings.colors.top.from.name = localConfig.UString("colors.top.from.name")
|
settings.colors.top.from.name = ymlConfig.UString("colors.top.from.name")
|
||||||
settings.colors.top.from.displayName = localConfig.UString("colors.top.from.displayName")
|
settings.colors.top.from.displayName = ymlConfig.UString("colors.top.from.displayName")
|
||||||
|
|
||||||
settings.colors.top.to.name = localConfig.UString("colors.top.to.name")
|
settings.colors.top.to.name = ymlConfig.UString("colors.top.to.name")
|
||||||
settings.colors.top.to.field = localConfig.UString("colors.top.to.field")
|
settings.colors.top.to.field = ymlConfig.UString("colors.top.to.field")
|
||||||
settings.colors.top.to.value = localConfig.UString("colors.top.to.value")
|
settings.colors.top.to.value = ymlConfig.UString("colors.top.to.value")
|
||||||
|
|
||||||
settings.currencies = make(map[string]*currency)
|
settings.currencies = make(map[string]*currency)
|
||||||
|
|
||||||
for key, val := range localConfig.UMap("currencies") {
|
for key, val := range ymlConfig.UMap("currencies") {
|
||||||
coercedVal := val.(map[string]interface{})
|
coercedVal := val.(map[string]interface{})
|
||||||
|
|
||||||
currency := ¤cy{
|
currency := ¤cy{
|
||||||
|
@ -42,34 +42,33 @@ type Settings struct {
|
|||||||
toplistSettings *toplist.Settings
|
toplistSettings *toplist.Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
currencies, _ := localConfig.Map("currencies")
|
currencies, _ := ymlConfig.Map("currencies")
|
||||||
top, _ := localConfig.Map("top")
|
top, _ := ymlConfig.Map("top")
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
currencies: currencies,
|
currencies: currencies,
|
||||||
top: top,
|
top: top,
|
||||||
|
|
||||||
priceSettings: price.NewSettingsFromYAML(name, ymlConfig),
|
priceSettings: price.NewSettingsFromYAML(name, ymlConfig, globalConfig),
|
||||||
toplistSettings: toplist.NewSettingsFromYAML(name, ymlConfig),
|
toplistSettings: toplist.NewSettingsFromYAML(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.from.name = localConfig.UString("colors.from.name")
|
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||||
settings.colors.from.displayName = localConfig.UString("colors.from.displayName")
|
settings.colors.from.displayName = ymlConfig.UString("colors.from.displayName")
|
||||||
|
|
||||||
settings.colors.to.name = localConfig.UString("colors.to.name")
|
settings.colors.to.name = ymlConfig.UString("colors.to.name")
|
||||||
settings.colors.to.price = localConfig.UString("colors.to.price")
|
settings.colors.to.price = ymlConfig.UString("colors.to.price")
|
||||||
|
|
||||||
settings.colors.top.from.name = localConfig.UString("colors.top.from.name")
|
settings.colors.top.from.name = ymlConfig.UString("colors.top.from.name")
|
||||||
settings.colors.top.from.displayName = localConfig.UString("colors.top.from.displayName")
|
settings.colors.top.from.displayName = ymlConfig.UString("colors.top.from.displayName")
|
||||||
|
|
||||||
settings.colors.top.to.name = localConfig.UString("colors.top.to.name")
|
settings.colors.top.to.name = ymlConfig.UString("colors.top.to.name")
|
||||||
settings.colors.top.to.field = localConfig.UString("colors.top.to.field")
|
settings.colors.top.to.field = ymlConfig.UString("colors.top.to.field")
|
||||||
settings.colors.top.to.value = localConfig.UString("colors.top.to.value")
|
settings.colors.top.to.value = ymlConfig.UString("colors.top.to.value")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -42,29 +42,28 @@ type Settings struct {
|
|||||||
top map[string]*currency
|
top map[string]*currency
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.from.name = localConfig.UString("colors.from.name")
|
settings.colors.from.name = ymlConfig.UString("colors.from.name")
|
||||||
settings.colors.from.displayName = localConfig.UString("colors.from.displayName")
|
settings.colors.from.displayName = ymlConfig.UString("colors.from.displayName")
|
||||||
|
|
||||||
settings.colors.to.name = localConfig.UString("colors.to.name")
|
settings.colors.to.name = ymlConfig.UString("colors.to.name")
|
||||||
settings.colors.to.price = localConfig.UString("colors.to.price")
|
settings.colors.to.price = ymlConfig.UString("colors.to.price")
|
||||||
|
|
||||||
settings.colors.top.from.name = localConfig.UString("colors.top.from.name")
|
settings.colors.top.from.name = ymlConfig.UString("colors.top.from.name")
|
||||||
settings.colors.top.from.displayName = localConfig.UString("colors.top.from.displayName")
|
settings.colors.top.from.displayName = ymlConfig.UString("colors.top.from.displayName")
|
||||||
|
|
||||||
settings.colors.top.to.name = localConfig.UString("colors.top.to.name")
|
settings.colors.top.to.name = ymlConfig.UString("colors.top.to.name")
|
||||||
settings.colors.top.to.field = localConfig.UString("colors.top.to.field")
|
settings.colors.top.to.field = ymlConfig.UString("colors.top.to.field")
|
||||||
settings.colors.top.to.value = localConfig.UString("colors.top.to.value")
|
settings.colors.top.to.value = ymlConfig.UString("colors.top.to.value")
|
||||||
|
|
||||||
settings.currencies = make(map[string]*currency)
|
settings.currencies = make(map[string]*currency)
|
||||||
|
|
||||||
for key, val := range localConfig.UMap("currencies") {
|
for key, val := range ymlConfig.UMap("currencies") {
|
||||||
coercedVal := val.(map[string]interface{})
|
coercedVal := val.(map[string]interface{})
|
||||||
|
|
||||||
limit, _ := coercedVal["limit"].(int)
|
limit, _ := coercedVal["limit"].(int)
|
||||||
@ -78,7 +77,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
|||||||
settings.currencies[key] = currency
|
settings.currencies[key] = currency
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, val := range localConfig.UMap("top") {
|
for key, val := range ymlConfig.UMap("top") {
|
||||||
coercedVal := val.(map[string]interface{})
|
coercedVal := val.(map[string]interface{})
|
||||||
|
|
||||||
limit, _ := coercedVal["limit"].(int)
|
limit, _ := coercedVal["limit"].(int)
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
tags []interface{}
|
tags []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_DATADOG_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_DATADOG_API_KEY")),
|
||||||
applicationKey: localConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),
|
applicationKey: ymlConfig.UString("applicationKey", os.Getenv("WTF_DATADOG_APPLICATION_KEY")),
|
||||||
tags: localConfig.UList("monitors.tags"),
|
tags: ymlConfig.UList("monitors.tags"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -32,28 +32,27 @@ type Settings struct {
|
|||||||
withLocation bool
|
withLocation bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
conflictIcon: localConfig.UString("conflictIcon", "🚨"),
|
conflictIcon: ymlConfig.UString("conflictIcon", "🚨"),
|
||||||
currentIcon: localConfig.UString("currentIcon", "🔸"),
|
currentIcon: ymlConfig.UString("currentIcon", "🔸"),
|
||||||
displayResponseStatus: localConfig.UBool("displayResponseStatus", true),
|
displayResponseStatus: ymlConfig.UBool("displayResponseStatus", true),
|
||||||
email: localConfig.UString("email", ""),
|
email: ymlConfig.UString("email", ""),
|
||||||
eventCount: localConfig.UInt("eventCount", 10),
|
eventCount: ymlConfig.UInt("eventCount", 10),
|
||||||
multiCalendar: localConfig.UBool("multiCalendar", false),
|
multiCalendar: ymlConfig.UBool("multiCalendar", false),
|
||||||
secretFile: localConfig.UString("secretFile", ""),
|
secretFile: ymlConfig.UString("secretFile", ""),
|
||||||
showDeclined: localConfig.UBool("showDeclined", false),
|
showDeclined: ymlConfig.UBool("showDeclined", false),
|
||||||
textInterval: localConfig.UInt("textInterval", 30),
|
textInterval: ymlConfig.UInt("textInterval", 30),
|
||||||
withLocation: localConfig.UBool("withLocation", true),
|
withLocation: ymlConfig.UBool("withLocation", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.day = localConfig.UString("colors.day", "forestgreen")
|
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
|
||||||
settings.colors.description = localConfig.UString("colors.description", "white")
|
settings.colors.description = ymlConfig.UString("colors.description", "white")
|
||||||
settings.colors.past = localConfig.UString("colors.past", "gray")
|
settings.colors.past = ymlConfig.UString("colors.past", "gray")
|
||||||
settings.colors.title = localConfig.UString("colors.title", "white")
|
settings.colors.title = ymlConfig.UString("colors.title", "white")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -27,21 +27,20 @@ type Settings struct {
|
|||||||
verifyServerCertificate bool
|
verifyServerCertificate bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
domain: localConfig.UString("domain", ""),
|
domain: ymlConfig.UString("domain", ""),
|
||||||
password: localConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),
|
password: ymlConfig.UString("password", os.Getenv("WTF_GERRIT_PASSWORD")),
|
||||||
projects: localConfig.UList("projects"),
|
projects: ymlConfig.UList("projects"),
|
||||||
username: localConfig.UString("username", ""),
|
username: ymlConfig.UString("username", ""),
|
||||||
verifyServerCertificate: localConfig.UBool("verifyServerCertificate", true),
|
verifyServerCertificate: ymlConfig.UBool("verifyServerCertificate", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.rows.even = localConfig.UString("colors.rows.even", "white")
|
settings.colors.rows.even = ymlConfig.UString("colors.rows.even", "white")
|
||||||
settings.colors.rows.odd = localConfig.UString("colors.rows.odd", "blue")
|
settings.colors.rows.odd = ymlConfig.UString("colors.rows.odd", "blue")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,15 @@ type Settings struct {
|
|||||||
repositories []interface{}
|
repositories []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
commitCount: localConfig.UInt("commitCount", 10),
|
commitCount: ymlConfig.UInt("commitCount", 10),
|
||||||
commitFormat: localConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),
|
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]"),
|
||||||
dateFormat: localConfig.UString("dateFormat", "%b %d, %Y"),
|
dateFormat: ymlConfig.UString("dateFormat", "%b %d, %Y"),
|
||||||
repositories: localConfig.UList("repositories"),
|
repositories: ymlConfig.UList("repositories"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -42,7 +42,7 @@ type Widget struct {
|
|||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "repository", "repositories"),
|
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.Name, "repository", "repositories"),
|
||||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
|
@ -20,18 +20,17 @@ type Settings struct {
|
|||||||
username string
|
username string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_GITHUB_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITHUB_TOKEN")),
|
||||||
baseURL: localConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),
|
baseURL: ymlConfig.UString("baseURL", os.Getenv("WTF_GITHUB_BASE_URL")),
|
||||||
enableStatus: localConfig.UBool("enableStatus", false),
|
enableStatus: ymlConfig.UBool("enableStatus", false),
|
||||||
repositories: localConfig.UMap("repositories"),
|
repositories: ymlConfig.UMap("repositories"),
|
||||||
uploadURL: localConfig.UString("uploadURL", os.Getenv("WTF_GITHUB_UPLOAD_URL")),
|
uploadURL: ymlConfig.UString("uploadURL", os.Getenv("WTF_GITHUB_UPLOAD_URL")),
|
||||||
username: localConfig.UString("username"),
|
username: ymlConfig.UString("username"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -18,16 +18,15 @@ type Settings struct {
|
|||||||
username string
|
username string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_GITLAB_TOKEN")),
|
||||||
domain: localConfig.UString("domain"),
|
domain: ymlConfig.UString("domain"),
|
||||||
projects: localConfig.UMap("projects"),
|
projects: ymlConfig.UMap("projects"),
|
||||||
username: localConfig.UString("username"),
|
username: ymlConfig.UString("username"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
roomURI string
|
roomURI string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiToken: localConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
|
apiToken: ymlConfig.UString("apiToken", os.Getenv("WTF_GITTER_API_TOKEN")),
|
||||||
numberOfMessages: localConfig.UInt("numberOfMessages", 10),
|
numberOfMessages: ymlConfig.UInt("numberOfMessages", 10),
|
||||||
roomURI: localConfig.UString("roomUri", "wtfutil/Lobby"),
|
roomURI: ymlConfig.UString("roomUri", "wtfutil/Lobby"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -21,18 +21,17 @@ type Settings struct {
|
|||||||
sheetID string
|
sheetID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
cellNames: localConfig.UList("cells.names"),
|
cellNames: ymlConfig.UList("cells.names"),
|
||||||
secretFile: localConfig.UString("secretFile"),
|
secretFile: ymlConfig.UString("secretFile"),
|
||||||
sheetID: localConfig.UString("sheetId"),
|
sheetID: ymlConfig.UString("sheetId"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.values = localConfig.UString("colors.values", "green")
|
settings.colors.values = ymlConfig.UString("colors.values", "green")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,13 @@ type Settings struct {
|
|||||||
storyType string
|
storyType string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
numberOfStories: localConfig.UInt("numberOfStories", 10),
|
numberOfStories: ymlConfig.UInt("numberOfStories", 10),
|
||||||
storyType: localConfig.UString("storyType", "top"),
|
storyType: ymlConfig.UString("storyType", "top"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.name = localConfig.UString("colors.name", "red")
|
settings.colors.name = ymlConfig.UString("colors.name", "red")
|
||||||
settings.colors.value = localConfig.UString("colors.value", "white")
|
settings.colors.value = ymlConfig.UString("colors.value", "white")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.name = localConfig.UString("colors.name", "red")
|
settings.colors.name = ymlConfig.UString("colors.name", "red")
|
||||||
settings.colors.value = localConfig.UString("colors.value", "white")
|
settings.colors.value = ymlConfig.UString("colors.value", "white")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -20,18 +20,17 @@ type Settings struct {
|
|||||||
verifyServerCertificate bool
|
verifyServerCertificate bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_JENKINS_API_KEY")),
|
||||||
jobNameRegex: localConfig.UString("jobNameRegex", ".*"),
|
jobNameRegex: ymlConfig.UString("jobNameRegex", ".*"),
|
||||||
successBallColor: localConfig.UString("successBallColor", "blue"),
|
successBallColor: ymlConfig.UString("successBallColor", "blue"),
|
||||||
url: localConfig.UString("url"),
|
url: ymlConfig.UString("url"),
|
||||||
user: localConfig.UString("user"),
|
user: ymlConfig.UString("user"),
|
||||||
verifyServerCertificate: localConfig.UBool("verifyServerCertificate", true),
|
verifyServerCertificate: ymlConfig.UBool("verifyServerCertificate", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -29,24 +29,23 @@ type Settings struct {
|
|||||||
verifyServerCertificate bool
|
verifyServerCertificate bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_JIRA_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_JIRA_API_KEY")),
|
||||||
domain: localConfig.UString("domain"),
|
domain: ymlConfig.UString("domain"),
|
||||||
email: localConfig.UString("email"),
|
email: ymlConfig.UString("email"),
|
||||||
jql: localConfig.UString("jql"),
|
jql: ymlConfig.UString("jql"),
|
||||||
username: localConfig.UString("username"),
|
username: ymlConfig.UString("username"),
|
||||||
verifyServerCertificate: localConfig.UBool("verifyServerCertificate", true),
|
verifyServerCertificate: ymlConfig.UBool("verifyServerCertificate", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.rows.even = localConfig.UString("colors.even", "lightblue")
|
settings.colors.rows.even = ymlConfig.UString("colors.even", "lightblue")
|
||||||
settings.colors.rows.odd = localConfig.UString("colors.odd", "white")
|
settings.colors.rows.odd = ymlConfig.UString("colors.odd", "white")
|
||||||
|
|
||||||
settings.projects = settings.arrayifyProjects(localConfig)
|
settings.projects = settings.arrayifyProjects(ymlConfig, globalConfig)
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
@ -54,18 +53,18 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
|||||||
/* -------------------- Unexported functions -------------------- */
|
/* -------------------- Unexported functions -------------------- */
|
||||||
|
|
||||||
// arrayifyProjects figures out if we're dealing with a single project or an array of projects
|
// arrayifyProjects figures out if we're dealing with a single project or an array of projects
|
||||||
func (settings *Settings) arrayifyProjects(localConfig *config.Config) []string {
|
func (settings *Settings) arrayifyProjects(ymlConfig *config.Config, globalConfig *config.Config) []string {
|
||||||
projects := []string{}
|
projects := []string{}
|
||||||
|
|
||||||
// Single project
|
// Single project
|
||||||
project, err := localConfig.String("project")
|
project, err := ymlConfig.String("project")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
projects = append(projects, project)
|
projects = append(projects, project)
|
||||||
return projects
|
return projects
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array of projects
|
// Array of projects
|
||||||
projectList := localConfig.UList("project")
|
projectList := ymlConfig.UList("project")
|
||||||
for _, projectName := range projectList {
|
for _, projectName := range projectList {
|
||||||
if project, ok := projectName.(string); ok {
|
if project, ok := projectName.(string); ok {
|
||||||
projects = append(projects, project)
|
projects = append(projects, project)
|
||||||
|
@ -15,15 +15,14 @@ type Settings struct {
|
|||||||
repositories []interface{}
|
repositories []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
commitCount: localConfig.UInt("commitCount", 10),
|
commitCount: ymlConfig.UInt("commitCount", 10),
|
||||||
commitFormat: localConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
|
commitFormat: ymlConfig.UString("commitFormat", "[forestgreen]{rev}:{phase} [white]{desc|firstline|strip} [grey]{author|person} {date|age}[white]"),
|
||||||
repositories: localConfig.UList("repositories"),
|
repositories: ymlConfig.UList("repositories"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -37,7 +37,7 @@ type Widget struct {
|
|||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "repository", "repositories"),
|
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.Name, "repository", "repositories"),
|
||||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
deployCount int
|
deployCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_NEW_RELIC_API_KEY")),
|
||||||
applicationID: localConfig.UInt("applicationID"),
|
applicationID: ymlConfig.UInt("applicationID"),
|
||||||
deployCount: localConfig.UInt("deployCount", 5),
|
deployCount: ymlConfig.UInt("deployCount", 5),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -18,35 +18,34 @@ type Settings struct {
|
|||||||
scheduleIdentifierType string
|
scheduleIdentifierType string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_OPS_GENIE_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_OPS_GENIE_API_KEY")),
|
||||||
displayEmpty: localConfig.UBool("displayEmpty", true),
|
displayEmpty: ymlConfig.UBool("displayEmpty", true),
|
||||||
scheduleIdentifierType: localConfig.UString("scheduleIdentifierType", "id"),
|
scheduleIdentifierType: ymlConfig.UString("scheduleIdentifierType", "id"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.schedule = settings.arrayifySchedules(localConfig)
|
settings.schedule = settings.arrayifySchedules(ymlConfig, globalConfig)
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
|
||||||
// arrayifySchedules figures out if we're dealing with a single project or an array of projects
|
// arrayifySchedules figures out if we're dealing with a single project or an array of projects
|
||||||
func (settings *Settings) arrayifySchedules(localConfig *config.Config) []string {
|
func (settings *Settings) arrayifySchedules(ymlConfig *config.Config, globalConfig *config.Config) []string {
|
||||||
schedules := []string{}
|
schedules := []string{}
|
||||||
|
|
||||||
// Single schedule
|
// Single schedule
|
||||||
schedule, err := localConfig.String("schedule")
|
schedule, err := ymlConfig.String("schedule")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
schedules = append(schedules, schedule)
|
schedules = append(schedules, schedule)
|
||||||
return schedules
|
return schedules
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array of schedules
|
// Array of schedules
|
||||||
scheduleList := localConfig.UList("schedule")
|
scheduleList := ymlConfig.UList("schedule")
|
||||||
for _, scheduleName := range scheduleList {
|
for _, scheduleName := range scheduleList {
|
||||||
if schedule, ok := scheduleName.(string); ok {
|
if schedule, ok := scheduleName.(string); ok {
|
||||||
schedules = append(schedules, schedule)
|
schedules = append(schedules, schedule)
|
||||||
|
@ -18,16 +18,15 @@ type Settings struct {
|
|||||||
showSchedules bool
|
showSchedules bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_PAGERDUTY_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_PAGERDUTY_API_KEY")),
|
||||||
escalationFilter: localConfig.UList("escalationFilter"),
|
escalationFilter: ymlConfig.UList("escalationFilter"),
|
||||||
showIncidents: localConfig.UBool("showIncidents", true),
|
showIncidents: ymlConfig.UBool("showIncidents", true),
|
||||||
showSchedules: localConfig.UBool("showSchedules", true),
|
showSchedules: ymlConfig.UBool("showSchedules", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -13,9 +13,9 @@ type Settings struct {
|
|||||||
filePath string
|
filePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -25,7 +25,7 @@ type Widget struct {
|
|||||||
// NewWidget Make new instance of widget
|
// NewWidget Make new instance of widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
BarGraph: wtf.NewBarGraph(app, settings.common.Name, settings.common.ConfigKey, false),
|
BarGraph: wtf.NewBarGraph(app, settings.common.Name, settings.common.Name, false),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -18,18 +18,17 @@ type Settings struct {
|
|||||||
projectOwner string
|
projectOwner string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
accessToken: localConfig.UString("accessToken"),
|
accessToken: ymlConfig.UString("accessToken"),
|
||||||
activeOnly: localConfig.UBool("activeOnly", false),
|
activeOnly: ymlConfig.UBool("activeOnly", false),
|
||||||
assignedToName: localConfig.UString("assignedToName"),
|
assignedToName: ymlConfig.UString("assignedToName"),
|
||||||
count: localConfig.UInt("count", 10),
|
count: ymlConfig.UInt("count", 10),
|
||||||
projectName: localConfig.UString("projectName", "Items"),
|
projectName: ymlConfig.UString("projectName", "Items"),
|
||||||
projectOwner: localConfig.UString("projectOwner"),
|
projectOwner: ymlConfig.UString("projectOwner"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
secretKey string
|
secretKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
callbackPort: localConfig.UString("callbackPort", "8080"),
|
callbackPort: ymlConfig.UString("callbackPort", "8080"),
|
||||||
clientID: localConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),
|
clientID: ymlConfig.UString("clientID", os.Getenv("SPOTIFY_ID")),
|
||||||
secretKey: localConfig.UString("secretKey", os.Getenv("SPOTIFY_SECRET")),
|
secretKey: ymlConfig.UString("secretKey", os.Getenv("SPOTIFY_SECRET")),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -15,15 +15,14 @@ type Settings struct {
|
|||||||
formatStyle string
|
formatStyle string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
filePaths: localConfig.UList("filePaths"),
|
filePaths: ymlConfig.UList("filePaths"),
|
||||||
format: localConfig.UBool("format", false),
|
format: ymlConfig.UBool("format", false),
|
||||||
formatStyle: localConfig.UString("formatStyle", "vim"),
|
formatStyle: ymlConfig.UString("formatStyle", "vim"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -42,7 +42,7 @@ type Widget struct {
|
|||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "filePath", "filePaths"),
|
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.Name, "filePath", "filePaths"),
|
||||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
|
@ -13,13 +13,12 @@ type Settings struct {
|
|||||||
filePath string
|
filePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
filePath: localConfig.UString("filename"),
|
filePath: ymlConfig.UString("filename"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -16,14 +16,13 @@ type Settings struct {
|
|||||||
projects []interface{}
|
projects []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TODOIST_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TODOIST_TOKEN")),
|
||||||
projects: localConfig.UList("projects"),
|
projects: ymlConfig.UList("projects"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -16,14 +16,13 @@ type Settings struct {
|
|||||||
pro bool
|
pro bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TRAVIS_API_TOKEN")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TRAVIS_API_TOKEN")),
|
||||||
pro: localConfig.UBool("pro", false),
|
pro: ymlConfig.UBool("pro", false),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -19,35 +19,34 @@ type Settings struct {
|
|||||||
username string
|
username string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
accessToken: localConfig.UString("accessToken", os.Getenv("WTF_TRELLO_ACCESS_TOKEN")),
|
accessToken: ymlConfig.UString("accessToken", os.Getenv("WTF_TRELLO_ACCESS_TOKEN")),
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_TRELLO_APP_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_TRELLO_APP_KEY")),
|
||||||
board: localConfig.UString("board"),
|
board: ymlConfig.UString("board"),
|
||||||
username: localConfig.UString("username"),
|
username: ymlConfig.UString("username"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.list = mapifyList(localConfig)
|
settings.list = mapifyList(ymlConfig, globalConfig)
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func mapifyList(localConfig *config.Config) map[string]string {
|
func mapifyList(ymlConfig *config.Config, globalConfig *config.Config) map[string]string {
|
||||||
lists := make(map[string]string)
|
lists := make(map[string]string)
|
||||||
|
|
||||||
// Single list
|
// Single list
|
||||||
list, err := localConfig.String("list")
|
list, err := ymlConfig.String("list")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
lists[list] = ""
|
lists[list] = ""
|
||||||
return lists
|
return lists
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array of lists
|
// Array of lists
|
||||||
listList := localConfig.UList("project")
|
listList := ymlConfig.UList("project")
|
||||||
for _, listName := range listList {
|
for _, listName := range listList {
|
||||||
if list, ok := listName.(string); ok {
|
if list, ok := listName.(string); ok {
|
||||||
lists[list] = ""
|
lists[list] = ""
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
screenNames []interface{}
|
screenNames []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
bearerToken: localConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
|
bearerToken: ymlConfig.UString("bearerToken", os.Getenv("WTF_TWITTER_BEARER_TOKEN")),
|
||||||
count: localConfig.UInt("count", 5),
|
count: ymlConfig.UInt("count", 5),
|
||||||
screenNames: localConfig.UList("screenName"),
|
screenNames: ymlConfig.UList("screenName"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -38,7 +38,7 @@ type Widget struct {
|
|||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||||
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.ConfigKey, "screenName", "screenNames"),
|
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common.Name, "screenName", "screenNames"),
|
||||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
|
@ -11,9 +11,9 @@ type Settings struct {
|
|||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -17,15 +17,14 @@ type Settings struct {
|
|||||||
team string
|
team string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiID: localConfig.UString("apiID", os.Getenv("WTF_VICTOROPS_API_ID")),
|
apiID: ymlConfig.UString("apiID", os.Getenv("WTF_VICTOROPS_API_ID")),
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_VICTOROPS_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_VICTOROPS_API_KEY")),
|
||||||
team: localConfig.UString("team"),
|
team: ymlConfig.UString("team"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -16,16 +16,15 @@ type Settings struct {
|
|||||||
language string
|
language string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
city: localConfig.UString("city", "Barcelona"),
|
city: ymlConfig.UString("city", "Barcelona"),
|
||||||
language: localConfig.UString("language", "en"),
|
language: ymlConfig.UString("language", "en"),
|
||||||
unit: localConfig.UString("unit", "m"),
|
unit: ymlConfig.UString("unit", "m"),
|
||||||
view: localConfig.UString("view", "0"),
|
view: ymlConfig.UString("view", "0"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -23,19 +23,18 @@ type Settings struct {
|
|||||||
tempUnit string
|
tempUnit string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_OWM_API_KEY")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("WTF_OWM_API_KEY")),
|
||||||
cityIDs: localConfig.UList("cityids"),
|
cityIDs: ymlConfig.UList("cityids"),
|
||||||
language: localConfig.UString("language", "EN"),
|
language: ymlConfig.UString("language", "EN"),
|
||||||
tempUnit: localConfig.UString("tempUnit", "C"),
|
tempUnit: ymlConfig.UString("tempUnit", "C"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.current = localConfig.UString("colors.current", "green")
|
settings.colors.current = ymlConfig.UString("colors.current", "green")
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
}
|
}
|
||||||
|
@ -18,16 +18,15 @@ type Settings struct {
|
|||||||
username string
|
username string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
localConfig, _ := ymlConfig.Get("wtf.mods." + configKey)
|
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
common: cfg.NewCommonSettingsFromYAML(name, configKey, ymlConfig),
|
common: cfg.NewCommonSettingsFromModule(name, ymlConfig, globalConfig),
|
||||||
|
|
||||||
apiKey: localConfig.UString("apiKey", os.Getenv("ZENDESK_API")),
|
apiKey: ymlConfig.UString("apiKey", os.Getenv("ZENDESK_API")),
|
||||||
status: localConfig.UString("status"),
|
status: ymlConfig.UString("status"),
|
||||||
subdomain: localConfig.UString("subdomain", os.Getenv("ZENDESK_SUBDOMAIN")),
|
subdomain: ymlConfig.UString("subdomain", os.Getenv("ZENDESK_SUBDOMAIN")),
|
||||||
username: localConfig.UString("username"),
|
username: ymlConfig.UString("username"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -14,7 +14,6 @@ type TextWidget struct {
|
|||||||
enabled bool
|
enabled bool
|
||||||
focusable bool
|
focusable bool
|
||||||
focusChar string
|
focusChar string
|
||||||
key string
|
|
||||||
name string
|
name string
|
||||||
refreshInterval int
|
refreshInterval int
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable
|
|||||||
enabled: commonSettings.Enabled,
|
enabled: commonSettings.Enabled,
|
||||||
focusable: focusable,
|
focusable: focusable,
|
||||||
focusChar: commonSettings.FocusChar(),
|
focusChar: commonSettings.FocusChar(),
|
||||||
key: commonSettings.ConfigKey,
|
|
||||||
name: commonSettings.Name,
|
name: commonSettings.Name,
|
||||||
refreshInterval: commonSettings.RefreshInterval,
|
refreshInterval: commonSettings.RefreshInterval,
|
||||||
}
|
}
|
||||||
@ -92,10 +90,6 @@ func (widget *TextWidget) IsPositionable() bool {
|
|||||||
return widget.Position.IsValid()
|
return widget.Position.IsValid()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *TextWidget) Key() string {
|
|
||||||
return widget.key
|
|
||||||
}
|
|
||||||
|
|
||||||
func (widget *TextWidget) Name() string {
|
func (widget *TextWidget) Name() string {
|
||||||
return widget.name
|
return widget.name
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ func ValidateWidgets(widgets []Wtfable) (bool, error) {
|
|||||||
|
|
||||||
for _, widget := range widgets {
|
for _, widget := range widgets {
|
||||||
if widget.Enabled() && !widget.IsPositionable() {
|
if widget.Enabled() && !widget.IsPositionable() {
|
||||||
errStr := fmt.Sprintf("Widget config has invalid values: %s", widget.Key())
|
errStr := fmt.Sprintf("Widget config has invalid values: %s", widget.Name())
|
||||||
log.Fatalln(errStr)
|
log.Fatalln(errStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ type Wtfable interface {
|
|||||||
BorderColor() string
|
BorderColor() string
|
||||||
FocusChar() string
|
FocusChar() string
|
||||||
Focusable() bool
|
Focusable() bool
|
||||||
Key() string
|
|
||||||
Name() string
|
Name() string
|
||||||
SetFocusChar(string)
|
SetFocusChar(string)
|
||||||
TextView() *tview.TextView
|
TextView() *tview.TextView
|
||||||
|
Loading…
x
Reference in New Issue
Block a user