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

Clean up the GitLab module's API credentials loading

This commit is contained in:
Chris Cummer 2018-07-31 15:08:44 -07:00
parent dd4088d76e
commit ba38772760
2 changed files with 10 additions and 6 deletions

View File

@ -24,11 +24,6 @@ All open merge requests created by you.
wtf/gitlab/
```
## Required ENV Variables
<span class="caption">Key:</span> `WTF_GITLAB_TOKEN` <br />
<span class="caption">Action:</span> A <a href="https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html">GitLab personal access token</a>. Requires at least `api` access.
## Keyboard Commands
<span class="caption">Key:</span> `/` <br />
@ -50,6 +45,7 @@ wtf/gitlab/
```yaml
gitlab:
apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
enabled: true
position:
top: 2
@ -65,6 +61,9 @@ gitlab:
### Attributes
`apiKey` <br />
Value: A <a href="https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html">GitLab personal access token</a>. Requires at least `api` access.
`enabled` <br />
Determines whether or not this module is executed and if its data displayed onscreen. <br />
Values: `true`, `false`.

View File

@ -34,9 +34,14 @@ type Widget struct {
}
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
apiKey := os.Getenv("WTF_GITLAB_TOKEN")
apiKey := wtf.Config.UString(
"wtf.mods.gitlab.apiKey",
os.Getenv("WTF_GITLAB_TOKEN"),
)
baseURL := wtf.Config.UString("wtf.mods.gitlab.domain")
gitlab := glb.NewClient(nil, apiKey)
if baseURL != "" {
gitlab.SetBaseURL(baseURL)
}