Skip to content

Conversation

@jackwrfuller
Copy link
Contributor

Description

Closes #457.

This PR introduces a new function environmentCheck() that checks a given environment name string belongs to a project, and if not, returns an error with valid options that the user has access to.

This PR only adds the check to the ssh command, but could be used for any command that mandates a project/environment input.

@shreddedbacon
Copy link
Member

#457 (comment)

@shreddedbacon
Copy link
Member

shreddedbacon commented Aug 18, 2025

In a lot of cases, the API should handle reporting if the environment doesn't exist, for SSH this is a bit different as it doesn't use the API directly.

The main difference here is that SSH portals exist, so for the CLI to know which portal endpoint to use, we have to check if the environment exists to get the portal endpoint it has associated to it.

So the check to get all the environments is already done, this function does it earlier though but it means you're doing two calls to the API every time you run an SSH command.

@jackwrfuller jackwrfuller changed the title feat: improved error message on invalid environment name feat: improved error message for ssh on invalid environment name Aug 18, 2025
@shreddedbacon shreddedbacon force-pushed the improved-environment-error branch from 83cd870 to 12ee395 Compare September 9, 2025 00:11
@shreddedbacon shreddedbacon merged commit ceed7fe into uselagoon:main Sep 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message for invalid environment name

2 participants