mirror of
https://github.com/packwiz/packwiz.git
synced 2025-11-03 19:54:32 +01:00
github: Use Viper for GitHub API token
Signed-off-by: unilock <unilock@fennet.rentals>
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user