gsh
gsh copied to clipboard
Resolve domain names at CLI
GSH CLI don't resolve domain names.
@mdjunior please provide with more information related to issue. I am a new contributor and want to contribute to this organization
Hi,
The GSH CLI interface does not resolve names like ssh.example.com to an IP address. Thus, when using the command "host-connect", a name is sent to the API instead of an IP as you can see here: https://github.com/globocom/gsh/blob/master/cli/cmd/hostConnect.go#L192.
This issue is for us to receive a contribution in order to validate that args[0] is an IP address. If it is a domain, a function can make it the IP address.
Hi there!
Been taking a look at a couple of issues and found this an interesting quick one to get started. I wrote a function to parse a given host and resolve (if a domain is given) or just pass the IP as received.
I did manage to test the function, and it appears to be working as intended, but I wasn't able to connect to a host using the cli, receiving a certificate error (I used the docker-compose dev environment):

Previously I had an issue with the gsh-realm.json file, where keycloak would give a "Invalid rootURL" error, upon changing it from "http://localhost:*" to "http://localhost" the issue of creating the realm was fixed.
I didn't open a PR since I wasn't able to fully test the host connect flow, but if you find it's already enough i'll be happy to open one up 😅
Thank you for the help and the hacktoberfest issue and event! My first time partaking in it and pretty excited 🥳