mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
refactor(projects): move rest api call directly into run command module
This commit is contained in:
@@ -6,6 +6,8 @@ package cmd
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/Infisical/infisical-merge/packages/api"
|
||||
"github.com/go-resty/resty/v2"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
@@ -480,7 +482,11 @@ func confirmProjectHasEnvironment(environmentSlug, projectId string, token *mode
|
||||
projectId = workspaceFile.WorkspaceId
|
||||
}
|
||||
|
||||
project, err := util.GetProjectDetails(accessToken, projectId)
|
||||
httpClient := resty.New()
|
||||
httpClient.SetAuthToken(accessToken).
|
||||
SetHeader("Accept", "application/json")
|
||||
|
||||
project, err := api.CallGetProjectById(httpClient, projectId)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/Infisical/infisical-merge/packages/api"
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
func GetProjectDetails(accessToken string, projectId string) (api.Project, error) {
|
||||
httpClient := resty.New()
|
||||
httpClient.SetAuthToken(accessToken).
|
||||
SetHeader("Accept", "application/json")
|
||||
|
||||
res, err := api.CallGetProjectById(httpClient, projectId)
|
||||
if err != nil {
|
||||
return api.Project{}, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user