1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Clean up the Jenkins module's API credentials loading

This commit is contained in:
Chris Cummer
2018-07-31 15:13:18 -07:00
parent ba38772760
commit 2fe8164e20
4 changed files with 20 additions and 13 deletions

View File

@@ -28,11 +28,10 @@ func (widget *Widget) Refresh() {
view, err := Create(
wtf.Config.UString("wtf.mods.jenkins.url"),
wtf.Config.UString("wtf.mods.jenkins.user"),
os.Getenv("WTF_JENKINS_API_KEY"),
widget.apiKey(),
)
widget.UpdateRefreshedAt()
//widget.View.Clear()
var content string
if err != nil {
@@ -50,6 +49,13 @@ func (widget *Widget) Refresh() {
/* -------------------- Unexported Functions -------------------- */
func (widget *Widget) apiKey() string {
return wtf.Config.UString(
"wtf.mods.jenkins.apiKey",
os.Getenv("WTF_JENKINS_API_KEY"),
)
}
func (widget *Widget) contentFrom(view *View) string {
str := fmt.Sprintf(" [red]%s[white]\n", view.Name)