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

Clean up the CircleCI module's API credentials loading

This commit is contained in:
Chris Cummer 2018-07-31 15:05:20 -07:00
parent 8fdaf52610
commit dd4088d76e
2 changed files with 10 additions and 7 deletions

View File

@ -16,12 +16,6 @@ Displays build information for your CircleCI account.
wtf/circleci/
```
## Required ENV Variables
<span class="caption">Key:</span> `WTF_CIRCLE_API_KEY` <br />
<span class="caption">Value:</span> Your <a href="https://circleci.com/account/api">CircleCI API</a>
token.
## Keyboard Commands
None.
@ -30,6 +24,7 @@ None.
```yaml
circleci:
apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
enabled: true
position:
top: 4
@ -41,6 +36,9 @@ circleci:
### Attributes
`apiKey` <br />
Value: Your <a href="https://circleci.com/account/api">CircleCI API</a> token.
`enabled` <br />
Determines whether or not this module is executed and if its data displayed onscreen. <br />
Values: `true`, `false`.

View File

@ -9,6 +9,8 @@ import (
"net/http"
"net/url"
"os"
"github.com/senorprogrammer/wtf/wtf"
)
const APIEnvKey = "WTF_CIRCLE_API_KEY"
@ -59,7 +61,10 @@ func circleRequest(path string) (*http.Response, error) {
}
func apiKey() string {
return os.Getenv(APIEnvKey)
return wtf.Config.UString(
"wtf.mods.circleci.apiKey",
os.Getenv(APIEnvKey),
)
}
func parseJson(obj interface{}, text io.Reader) {