mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: update error message being displayed
This commit is contained in:
@@ -63,7 +63,7 @@ func getDynamicSecretList(cmd *cobra.Command, args []string) {
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ func createDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ func renewDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ func revokeDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
@@ -523,7 +523,7 @@ func listDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ var createCmd = &cobra.Command{
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get workspace file")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
@@ -180,7 +180,7 @@ var deleteCmd = &cobra.Command{
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get workspace file")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
|
|||||||
@@ -172,7 +172,10 @@ var secretsSetCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if token == nil && projectId == "" {
|
if token == nil && projectId == "" {
|
||||||
util.RequireLocalWorkspaceFile()
|
_, err := util.GetWorkSpaceFromFile()
|
||||||
|
if err != nil {
|
||||||
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
secretsPath, err := cmd.Flags().GetString("path")
|
secretsPath, err := cmd.Flags().GetString("path")
|
||||||
@@ -225,7 +228,7 @@ var secretsSetCmd = &cobra.Command{
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "unable to get your local config details [err=%v]")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
@@ -308,7 +311,7 @@ var secretsDeleteCmd = &cobra.Command{
|
|||||||
if projectId == "" {
|
if projectId == "" {
|
||||||
workspaceFile, err := util.GetWorkSpaceFromFile()
|
workspaceFile, err := util.GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err, "Unable to get local project details")
|
util.PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
projectId = workspaceFile.WorkspaceId
|
projectId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func GetAllFolders(params models.GetAllFoldersParameters) ([]models.SingleFolder
|
|||||||
if params.WorkspaceId == "" {
|
if params.WorkspaceId == "" {
|
||||||
workspaceFile, err := GetWorkSpaceFromFile()
|
workspaceFile, err := GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
params.WorkspaceId = workspaceFile.WorkspaceId
|
params.WorkspaceId = workspaceFile.WorkspaceId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,7 +253,10 @@ func GetAllEnvironmentVariables(params models.GetAllSecretsParameters, projectCo
|
|||||||
if params.InfisicalToken == "" && params.UniversalAuthAccessToken == "" {
|
if params.InfisicalToken == "" && params.UniversalAuthAccessToken == "" {
|
||||||
if params.WorkspaceId == "" {
|
if params.WorkspaceId == "" {
|
||||||
if projectConfigFilePath == "" {
|
if projectConfigFilePath == "" {
|
||||||
RequireLocalWorkspaceFile()
|
_, err := GetWorkSpaceFromFile()
|
||||||
|
if err != nil {
|
||||||
|
PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ValidateWorkspaceFile(projectConfigFilePath)
|
ValidateWorkspaceFile(projectConfigFilePath)
|
||||||
}
|
}
|
||||||
@@ -284,7 +287,7 @@ func GetAllEnvironmentVariables(params models.GetAllSecretsParameters, projectCo
|
|||||||
if projectConfigFilePath == "" {
|
if projectConfigFilePath == "" {
|
||||||
projectConfig, err := GetWorkSpaceFromFile()
|
projectConfig, err := GetWorkSpaceFromFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
PrintErrorMessageAndExit("Please either run infisical init to connect to a project or pass in project id with --projectId flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
infisicalDotJson = projectConfig
|
infisicalDotJson = projectConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user