-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(cli): automatically determine rpc host/port #1462
Conversation
9ae90b8
to
e0b6ee2
Compare
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 feature itself works nicely for all networks 👍
The only minor nit I have is the error message when xud is not running:
➜ xud git:(cli/detect-network) ✗ ./bin/xucli getinfo -j | jq
could not connect to xud at undefined:undefined, is xud running?
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.
e0b6ee2
to
fb3ae65
Compare
Good catch, I put in a quick fix to preserve the port and host we determined to use. Thanks. |
I'm now getting:
using this branch (when xud is running & also closed). |
lib/cli/command.ts
Outdated
argv.rpcport = config.rpc.port; | ||
argv.rpchost = config.rpc.host; | ||
|
||
return new XudClient(`${argv.rpchost}}:${argv.rpcport}`, credentials); |
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.
Looks like I typoed an extra }
here after rpchost
which is why the DNS resolution failures were happening, it was trying to resolve localhost}
instead of localhost
. Took me a while to figure out what was going on because I could've sworn it was working for me when I had tested it then I was getting the dns error too out of the blue. Thanks for catching this @erkarl .
fb3ae65
to
69a4e66
Compare
This enhances the cli to automatically attempt to find and read from the xud configuration file to determine the port and host for the xud gRPC service based on the configured network - which determines default port numbers - or configured port if specified. This prevents the user from having to specify the rpc port on `xucli` commands when using a non-mainnet xud instance or a non-default gRPC port via the config file. Closes #1451.
69a4e66
to
2063fe0
Compare
This enhances the cli to automatically attempt to find and read from the xud configuration file to determine the port and host for the xud gRPC service based on the configured network - which determines default port numbers - or configured port if specified. This prevents the user from having to specify the rpc port on
xucli
commands when using a non-mainnet xud instance or a non-default gRPC port via the config file.Closes #1451.