mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 11:27:47 +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 (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/Infisical/infisical-merge/packages/api"
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -480,7 +482,11 @@ func confirmProjectHasEnvironment(environmentSlug, projectId string, token *mode
|
|||||||
projectId = workspaceFile.WorkspaceId
|
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 {
|
if err != nil {
|
||||||
return false, err
|
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