diff --git a/_site/content/posts/modules/jenkins.md b/_site/content/posts/modules/jenkins.md index 326420c7..d2577979 100644 --- a/_site/content/posts/modules/jenkins.md +++ b/_site/content/posts/modules/jenkins.md @@ -17,11 +17,6 @@ width="320" height="68" alt="jenkins screenshot" /> wtf/jenkins/ ``` -## Required ENV Variables - -Key: `WTF_JENKINS_API_KEY`
-Value: Your Jenkins API key. - ## Keyboard Commands None. @@ -30,6 +25,7 @@ None. ```yaml jenkins: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 2 @@ -44,6 +40,9 @@ jenkins: ### Attributes +`apiKey`
+Value: Your Jenkins API key. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/_site/content/posts/modules/travisci.md b/_site/content/posts/modules/travisci.md index dcb5eebf..e162c9a6 100644 --- a/_site/content/posts/modules/travisci.md +++ b/_site/content/posts/modules/travisci.md @@ -16,11 +16,6 @@ Displays build information for your Travis CI account. wtf/travisci/ ``` -## Required ENV Variables - -Key: `WTF_TRAVIS_API_TOKEN`
-Value: Your Travis CI API access token. - ## Keyboard Commands None. @@ -29,6 +24,7 @@ None. ```yaml travisci: + apiKey: "3276d7155dd9ee27b8b14f8743a408a9" enabled: true position: top: 4 @@ -41,6 +37,9 @@ travisci: ### Attributes +`apiKey`
+Value: Your Travis CI API access token. + `enabled`
Determines whether or not this module is executed and if its data displayed onscreen.
Values: `true`, `false`. diff --git a/jenkins/widget.go b/jenkins/widget.go index 262da966..cf12609f 100644 --- a/jenkins/widget.go +++ b/jenkins/widget.go @@ -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) diff --git a/travisci/client.go b/travisci/client.go index 8e80d0de..1e66cb41 100644 --- a/travisci/client.go +++ b/travisci/client.go @@ -72,7 +72,10 @@ func travisRequest(path string) (*http.Response, error) { } func apiToken() string { - return os.Getenv(APIEnvToken) + return wtf.Config.UString( + "wtf.mods.travisci.apiKey", + os.Getenv(APIEnvToken), + ) } func parseJson(obj interface{}, text io.Reader) {