planetscale/cli

Flag to cause `pscale connect` to fail if the requested port is in use?

bryanrsmith opened this issue · 2 comments

I use some scripts for local development that involve running pscale connect --port 3306, and then starting the dev server for a project that expects the database to be available at :3306.

Currently if 3306 is already in use (e.g., if the script was previously run in another terminal window), pscale will randomly select a different port, and my application won't be talking to the correct thing. I'd really love for pscale connect to fail if the requested port was not available so that I'm aware of the mismatch. With the current behavior I don't have a convenient way to detect this.

Can a flag be added to prevent the random port selection, or alternatively, can pscale fail if an explicitly requested port is not available?

Okay, just merged in a PR for this and it will be cutting a new release soon. Thanks for the suggestion!

Amazing. Thank you!