mirror of
https://github.com/packwiz/packwiz.git
synced 2025-05-01 02:06:30 +02:00
github: Use Viper for GitHub API token
Signed-off-by: unilock <unilock@fennet.rentals>
This commit is contained in:
parent
8d4f8d9a86
commit
d7fd884f48
@ -3,9 +3,9 @@ package github
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/packwiz/packwiz/core"
|
"github.com/packwiz/packwiz/core"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: allow setting github api key via env variable
|
// TODO: allow setting github api key via env variable
|
||||||
@ -18,7 +18,7 @@ type ghApiClient struct {
|
|||||||
var ghDefaultClient = ghApiClient{&http.Client{}}
|
var ghDefaultClient = ghApiClient{&http.Client{}}
|
||||||
|
|
||||||
func (c *ghApiClient) makeGet(url string) (*http.Response, error) {
|
func (c *ghApiClient) makeGet(url string) (*http.Response, error) {
|
||||||
ghApiToken := os.Getenv("GH_API_TOKEN")
|
ghApiToken := viper.GetString("github.token")
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest("GET", url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user