From 62aa80a1041cfb5c46206503ac6f09b6ba166bb9 Mon Sep 17 00:00:00 2001 From: Mahyar Mirrashed Date: Thu, 13 Mar 2025 11:14:57 -0700 Subject: [PATCH] feat(run): ensure that the project has the requested environment --- cli/packages/cmd/run.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cli/packages/cmd/run.go b/cli/packages/cmd/run.go index d2a631e1b..bb23edf32 100644 --- a/cli/packages/cmd/run.go +++ b/cli/packages/cmd/run.go @@ -136,6 +136,18 @@ var runCmd = &cobra.Command{ util.HandleError(err, "Unable to parse flag") } + log.Debug().Msgf("Confirming selected environment is valid: %s", environmentName) + + hasEnvironment, err := confirmProjectHasEnvironment(projectId, environmentName, token.Token) + if err != nil { + util.HandleError(err, "Could not confirm project has environment") + } + if !hasEnvironment { + util.HandleError(fmt.Errorf("project '%s' does not have environment '%s'", projectId, environmentName)) + } + + log.Debug().Msgf("Project '%s' has environment '%s'", projectId, environmentName) + request := models.GetAllSecretsParameters{ Environment: environmentName, WorkspaceId: projectId,