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:
parent
dd4088d76e
commit
ba38772760
@ -24,11 +24,6 @@ All open merge requests created by you.
|
|||||||
wtf/gitlab/
|
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
|
## Keyboard Commands
|
||||||
|
|
||||||
<span class="caption">Key:</span> `/` <br />
|
<span class="caption">Key:</span> `/` <br />
|
||||||
@ -50,6 +45,7 @@ wtf/gitlab/
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
gitlab:
|
gitlab:
|
||||||
|
apiKey: "3276d7155dd9ee27b8b14f8743a408a9"
|
||||||
enabled: true
|
enabled: true
|
||||||
position:
|
position:
|
||||||
top: 2
|
top: 2
|
||||||
@ -65,6 +61,9 @@ gitlab:
|
|||||||
|
|
||||||
### Attributes
|
### 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 />
|
`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`.
|
||||||
|
@ -34,9 +34,14 @@ type Widget struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
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")
|
baseURL := wtf.Config.UString("wtf.mods.gitlab.domain")
|
||||||
gitlab := glb.NewClient(nil, apiKey)
|
gitlab := glb.NewClient(nil, apiKey)
|
||||||
|
|
||||||
if baseURL != "" {
|
if baseURL != "" {
|
||||||
gitlab.SetBaseURL(baseURL)
|
gitlab.SetBaseURL(baseURL)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user