From d7fd884f48ed559226d5f3dbdf6f8a8056e28fd1 Mon Sep 17 00:00:00 2001 From: unilock Date: Mon, 11 Sep 2023 09:11:14 -0400 Subject: [PATCH] github: Use Viper for GitHub API token Signed-off-by: unilock --- github/request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/request.go b/github/request.go index 28b2119..5b1a429 100644 --- a/github/request.go +++ b/github/request.go @@ -3,9 +3,9 @@ package github import ( "fmt" "net/http" - "os" "github.com/packwiz/packwiz/core" + "github.com/spf13/viper" ) // TODO: allow setting github api key via env variable @@ -18,7 +18,7 @@ type ghApiClient struct { var ghDefaultClient = ghApiClient{&http.Client{}} 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) if err != nil {