mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Clean up the Gerrit module's API credentials loading
This commit is contained in:
parent
ebad879e0a
commit
8fdaf52610
@ -4,8 +4,6 @@ date: 2018-06-27T15:55:42-07:00
|
|||||||
draft: false
|
draft: false
|
||||||
---
|
---
|
||||||
|
|
||||||
<img src="/imgs/modules/gerrit.png" width="640" height="384" alt="gerrit screenshot" />
|
|
||||||
|
|
||||||
Displays information about your projects hosted on Gerrit:
|
Displays information about your projects hosted on Gerrit:
|
||||||
|
|
||||||
#### Open Incoming Reviews
|
#### Open Incoming Reviews
|
||||||
@ -16,17 +14,14 @@ All open reviews that are requesting your approval.
|
|||||||
|
|
||||||
All open reviews created by you.
|
All open reviews created by you.
|
||||||
|
|
||||||
|
<img src="/imgs/modules/gerrit.png" width="640" height="167" alt="gerrit screenshot" />
|
||||||
|
|
||||||
## Source Code
|
## Source Code
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wtf/gerrit/
|
wtf/gerrit/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Required ENV Variables
|
|
||||||
|
|
||||||
<span class="caption">Key:</span> `WTF_GERRIT_PASSWORD` <br />
|
|
||||||
<span class="caption">Action:</span> Your <a href="https://gerrit-review.googlesource.com/Documentation/user-upload.html#http">Gerrit HTTP Password</a>.
|
|
||||||
|
|
||||||
## Keyboard Commands
|
## Keyboard Commands
|
||||||
|
|
||||||
<span class="caption">Key:</span> `/` <br />
|
<span class="caption">Key:</span> `/` <br />
|
||||||
@ -59,6 +54,7 @@ gerrit:
|
|||||||
projects:
|
projects:
|
||||||
- org/test-project"
|
- org/test-project"
|
||||||
- dotfiles
|
- dotfiles
|
||||||
|
password: "mypassword"
|
||||||
username: "myname"
|
username: "myname"
|
||||||
verifyServerCertificate: false
|
verifyServerCertificate: false
|
||||||
```
|
```
|
||||||
@ -83,8 +79,11 @@ Values: A valid URI.
|
|||||||
`projects` <br />
|
`projects` <br />
|
||||||
A list of Gerrit project names to fetch data for. <br />
|
A list of Gerrit project names to fetch data for. <br />
|
||||||
|
|
||||||
|
`password` <br />
|
||||||
|
Value: Your <a href="https://gerrit-review.googlesource.com/Documentation/user-upload.html#http">Gerrit HTTP Password</a>.
|
||||||
|
|
||||||
`username` <br />
|
`username` <br />
|
||||||
Your Gerrit username. <br />
|
Your Gerrit username.
|
||||||
|
|
||||||
`verifyServerCertificate` <br />
|
`verifyServerCertificate` <br />
|
||||||
_Optional_ <br />
|
_Optional_ <br />
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 36 KiB |
@ -19,8 +19,6 @@ type Client struct {
|
|||||||
func NewClient(url string) *Client {
|
func NewClient(url string) *Client {
|
||||||
client := Client{
|
client := Client{
|
||||||
apiBase: url,
|
apiBase: url,
|
||||||
//apiKey: os.Getenv("WTF_BAMBOO_HR_TOKEN"),
|
|
||||||
//subdomain: os.Getenv("WTF_BAMBOO_HR_SUBDOMAIN"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.loadAPICredentials()
|
client.loadAPICredentials()
|
||||||
|
@ -3,13 +3,14 @@ package gerrit
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
glb "github.com/andygrunwald/go-gerrit"
|
glb "github.com/andygrunwald/go-gerrit"
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
"github.com/senorprogrammer/wtf/wtf"
|
"github.com/senorprogrammer/wtf/wtf"
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"regexp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const HelpText = `
|
const HelpText = `
|
||||||
@ -43,7 +44,12 @@ var (
|
|||||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||||
baseURL := wtf.Config.UString("wtf.mods.gerrit.domain")
|
baseURL := wtf.Config.UString("wtf.mods.gerrit.domain")
|
||||||
username := wtf.Config.UString("wtf.mods.gerrit.username")
|
username := wtf.Config.UString("wtf.mods.gerrit.username")
|
||||||
password := os.Getenv("WTF_GERRIT_PASSWORD")
|
|
||||||
|
password := wtf.Config.UString(
|
||||||
|
"wtf.mods.gerrit.password",
|
||||||
|
os.Getenv("WTF_GERRIT_PASSWORD"),
|
||||||
|
)
|
||||||
|
|
||||||
verifyServerCertificate := wtf.Config.UBool("wtf.mods.gerrit.verifyServerCertificate", true)
|
verifyServerCertificate := wtf.Config.UBool("wtf.mods.gerrit.verifyServerCertificate", true)
|
||||||
|
|
||||||
httpClient := &http.Client{Transport: &http.Transport{
|
httpClient := &http.Client{Transport: &http.Transport{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user