-
Notifications
You must be signed in to change notification settings - Fork 1
Added TODO #2 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,8 +58,8 @@ func init() { | |||||||||||||
| envCmd.AddCommand(envPullCmd) | ||||||||||||||
| envCmd.AddCommand(envPushCmd) | ||||||||||||||
|
|
||||||||||||||
| // Add --preview flag for env commands to target preview deployments (from PRs) | ||||||||||||||
| envCmd.PersistentFlags().BoolVar(&previewFlag, "preview", false, "Target preview deployments (from Pull Requests)") | ||||||||||||||
| envCmd.PersistentFlags().BoolVar(&prodFlag, "prod", false, "Target production deployment (from Pull Requests)") | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func getAppUUID() (string, *api.Client, error) { | ||||||||||||||
|
|
@@ -163,7 +163,11 @@ func runEnvAdd(cmd *cobra.Command, args []string) error { | |||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // Set is_preview based on flag | ||||||||||||||
| if prodFlag && previewFlag { | ||||||||||||||
| ui.Error("Cannot use both --prod and --preview") | ||||||||||||||
| return fmt.Errorf("conflicting flags") | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
scooterthedev marked this conversation as resolved.
|
||||||||||||||
| isPreview := previewFlag | ||||||||||||||
|
|
||||||||||||||
| ui.Info(fmt.Sprintf("Adding %s...", key)) | ||||||||||||||
|
|
@@ -189,6 +193,20 @@ func runEnvRm(cmd *cobra.Command, args []string) error { | |||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if !prodFlag && !previewFlag { | ||||||||||||||
| ui.Error("Must use either --prod or --preview flag") | ||||||||||||||
| ui.Spacer() | ||||||||||||||
| ui.Print("Examples:") | ||||||||||||||
| ui.Print(" " + ui.CodeStyle.Render(fmt.Sprintf("%s env rm KEY --prod", execName()))) | ||||||||||||||
| ui.Print(" " + ui.CodeStyle.Render(fmt.Sprintf("%s env rm KEY --preview", execName()))) | ||||||||||||||
| return fmt.Errorf("deployment type not specified") | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if prodFlag && previewFlag { | ||||||||||||||
| ui.Error("Cannot use both --prod and --preview") | ||||||||||||||
| return fmt.Errorf("conflicting flags") | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // Confirm deletion | ||||||||||||||
| confirmed, err := ui.ConfirmAction("remove environment variable", key) | ||||||||||||||
| if err != nil { | ||||||||||||||
|
|
@@ -246,6 +264,11 @@ func runEnvPull(cmd *cobra.Command, args []string) error { | |||||||||||||
| return err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if prodFlag && previewFlag { | ||||||||||||||
| ui.Error("Cannot use both --prod and --preview") | ||||||||||||||
| return fmt.Errorf("conflicting flags") | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| } | |
| } | |
| if !prodFlag && !previewFlag { | |
| ui.Error("Please specify either --prod or --preview") | |
| return fmt.Errorf("no environment specified") | |
| } |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runEnvPush function doesn't check if neither --prod nor --preview is specified, unlike runEnvRm. This creates inconsistent behavior - runEnvPush will default to production when no flag is specified, while runEnvRm requires an explicit flag. For consistency and to prevent accidental production operations, runEnvPush should also require an explicit flag specification.
| } | |
| } | |
| if !prodFlag && !previewFlag { | |
| ui.Error("You must specify either --prod or --preview") | |
| return fmt.Errorf("missing required environment flag") | |
| } |
Uh oh!
There was an error while loading. Please reload this page.