Skip to content
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

detect if dcrcli.conf is not configured #50

Closed
raedah opened this issue Dec 12, 2018 · 4 comments
Closed

detect if dcrcli.conf is not configured #50

raedah opened this issue Dec 12, 2018 · 4 comments

Comments

@raedah
Copy link
Member

raedah commented Dec 12, 2018

When running ./dcrcli with no commands, currently the simple dcrcli usage cmds are shown. But these commands are not yet available if the user does not have dcrcli.conf set with the correct rpc login information. So this should be detected, and a msg displayed to let the user know that they need to specify this information. The simple usage commands would not be displayed, and instead instructions would be displayed to set edit the config file or to specify the appropriate rpc command line options (-h).

Additionally, we could autoconfigure by looking for the default dcrwallet config and auto parsing the needed settings, asking the user if they would like to use these values.

@raedah
Copy link
Member Author

raedah commented Dec 12, 2018

The above should also take care of the failures that show unfriendly errors such as

$ ./dcrcli balance
Error executing command 'balance'
error fetching accounts: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transpor
t: Error while dialing dial tcp: missing address"

@raedah raedah added this to ToDo in godcr board Dec 13, 2018
@itswisdomagain
Copy link
Contributor

I've had that error even with dcrcli properly configured but without dcrwallet actually running... There might be another way to prevent that error. Will look into that

@ademuanthony ademuanthony moved this from ToDo to In Progress in godcr board Dec 17, 2018
@ademuanthony ademuanthony moved this from In Progress to For Review in godcr board Dec 17, 2018
@itswisdomagain
Copy link
Contributor

itswisdomagain commented Dec 23, 2018

The above should also take care of the failures that show unfriendly errors such as

$ ./dcrcli balance
Error executing command 'balance'
error fetching accounts: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transpor
t: Error while dialing dial tcp: missing address"

I want to create a separate issue for this as it does not relate to the absence or presence of dcrcli configuration. The error is due to invalid rpc configuration values. Want to keep this issue and the associated PR #64 focused on just taking care of scenarios where dcrcli is not configured.

EDIT: The error missing address represents cases where dcrwallet rpc server address is not set in config and not passed in command-line. This can happen even if dcrcli.conf exists and is configured (partly)

A similar error occurs when the dcrwallet rpc server address is set but dcrcli cannot connect to that address either because it is completely incorrect/invalid or because dcrwallet was not running at the time the connection attempt was made.

For simplicity and focus, this issue and the associating PR should focus on detecting the absence of dcrcli.conf file and providing the user with a means to create the config file or advising the user to pass required drcwallet configuration values via the command-line. This would hopefully also take care of the scenario where dcrwallet rpc server address is not set, but not necessarily.

If a user manually creates a config file, a value for dcrwallet rpc server address may not be set in the config file and may not be passed in command-line options. dcrcli.conf exists but dcrwallet rpc server address does not. Or the server address could exist but does not point to an actively running dcrwallet daemon. These scenarios will be taken care of in #77

@itswisdomagain itswisdomagain moved this from For Review to In Progress in godcr board Dec 25, 2018
@itswisdomagain itswisdomagain moved this from In Progress to For Review in godcr board Dec 28, 2018
@itswisdomagain
Copy link
Contributor

This planetdecred/godcr#64 (comment) explains why this issue isn't actually an issue - or shouldn't have been an issue.

In summary,

When running ./dcrcli with no commands, currently the simple dcrcli usage cmds are shown. But these commands are not yet available if the user does not have dcrcli.conf set with the correct rpc login information

True

So this should be detected, and a msg displayed to let the user know that they need to specify this information. The simple usage commands would not be displayed, and instead instructions would be displayed to set edit the config file or to specify the appropriate rpc command line options (-h).

Not really. The rpc connection information we need are rpcAddress and rpcCert. For the latter case, if a value isn't present i config or command-line options, an error message isn't displayed. Instead a default value is used. This same pattern has been introduced in #80 - thus, we no longer need to show the user any message about missing rpc information.

Additionally, we could autoconfigure by looking for the default dcrwallet config and auto parsing the needed settings, asking the user if they would like to use these values.

This however is something that we could and prolly should do. Will make this into a separate low-priority issue.

@itswisdomagain itswisdomagain removed this from For Review in godcr board Dec 30, 2018
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 a pull request may close this issue.

2 participants