Skip to content

Commit 6e012f6

Browse files
committed
feat: allow RUNPOD_API_URL env if api url is not defined in config
1 parent 047ce42 commit 6e012f6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/query.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ func Query(input Input) (res *http.Response, err error) {
2121
return
2222
}
2323

24+
apiUrl := os.Getenv("RUNPOD_API_URL")
25+
if apiUrl == "" {
26+
apiUrl = viper.GetString("apiUrl")
27+
}
2428
apiKey := os.Getenv("RUNPOD_API_KEY")
2529
if apiKey == "" {
2630
apiKey = viper.GetString("apiKey")
2731
}
28-
req, err := http.NewRequest("POST", viper.GetString("apiUrl")+"?api_key="+apiKey, bytes.NewBuffer(jsonValue))
32+
req, err := http.NewRequest("POST", apiUrl+"?api_key="+apiKey, bytes.NewBuffer(jsonValue))
2933
if err != nil {
3034
return
3135
}

0 commit comments

Comments
 (0)