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:
parent
8fdaf52610
commit
dd4088d76e
@ -16,12 +16,6 @@ Displays build information for your CircleCI account.
|
|||||||
wtf/circleci/
|
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
|
## Keyboard Commands
|
||||||
|
|
||||||
None.
|
None.
|
||||||
@ -30,6 +24,7 @@ None.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
circleci:
|
circleci:
|
||||||
|
apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top: 4
|
top: 4
|
||||||
@ -41,6 +36,9 @@ circleci:
|
|||||||
|
|
||||||
### Attributes
|
### Attributes
|
||||||
|
|
||||||
|
`apiKey` <br />
|
||||||
|
Value: Your <a href="https://circleci.com/account/api">CircleCI API</a> token.
|
||||||
|
|
||||||
`enabled` <br />
|
`enabled` <br />
|
||||||
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
Determines whether or not this module is executed and if its data displayed onscreen. <br />
|
||||||
Values: `true`, `false`.
|
Values: `true`, `false`.
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/senorprogrammer/wtf/wtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APIEnvKey = "WTF_CIRCLE_API_KEY"
|
const APIEnvKey = "WTF_CIRCLE_API_KEY"
|
||||||
@ -59,7 +61,10 @@ func circleRequest(path string) (*http.Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func apiKey() string {
|
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) {
|
func parseJson(obj interface{}, text io.Reader) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user