diff --git a/internal/diyhrt/fetch.go b/internal/diyhrt/fetch.go index 632cf2b..d2c9fb6 100644 --- a/internal/diyhrt/fetch.go +++ b/internal/diyhrt/fetch.go @@ -4,16 +4,14 @@ import ( "encoding/json" "errors" "net/http" - "os" "time" ) const endpoint = "https://diyhrt.market/api/listings" -func GetListings() ([]Listing, error) { - apiKey := os.Getenv("API_KEY") +func GetListings(apiKey string) ([]Listing, error) { if apiKey == "" { - return nil, errors.New("API_KEY environment variable not set") + return nil, errors.New("API_KEY key not set. Set it as env or in DiyHrt.ApiKey") } // Create HTTP client diff --git a/main.go b/main.go index e507f79..db33ecf 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ var CurrentConfig = rendering.NewConfig() func FetchDiyHrt() error { fmt.Println("Fetch DiyHrt Marketplaces...") - l, err := diyhrt.GetListings() + l, err := diyhrt.GetListings(CurrentConfig.DiyHrt.ApiKey) if err != nil { return err } diff --git a/tmp/build-errors.log b/tmp/build-errors.log index 05e5985..4660a1c 100644 --- a/tmp/build-errors.log +++ b/tmp/build-errors.log @@ -1 +1 @@ -exit status 1 \ No newline at end of file +exit status 1exit status 1 \ No newline at end of file