aidansteele / rdsconn

rdsconn makes connecting to an AWS RDS instance inside a VPC from your laptop easier
MIT License
108 stars 6 forks source link

fix: Return/output correct local port when using --local-port flag #4

Closed byronwolfman closed 1 year ago

byronwolfman commented 1 year ago

Thanks for this tool! I often have port 5432 allocated for local development shenanigans, so I tried allocating a different port when connecting to an RDS instance. I got this output:

wolfman $ rdsconn proxy --local-port=15432
✔ some-rds-instance
Proxy running. Now waiting to serve connections to localhost:0...

Despite the wording, the port that rdsconn allocates is in fact 15432, but the listenerAndPort function returns 0 so it's not immediately clear. It looks like this returned port value is only used to print out the listening status, so this change should be fairly safe.

Behaviour with this change:

wolfman $ rdsconn proxy --local-port=15432
✔ some-rds-instance
Proxy running. Now waiting to serve connections to localhost:15432...
aidansteele commented 1 year ago

Thank you so much for the fix! I clearly didn't test this enough 😅