koinos / koinos-cli

A command line utility used for key management and to interact with the Koinos blockchain.
Other
8 stars 7 forks source link

[FEATURE]: Skip loading of koinosrc file if RPC endpoint is passed on the command line #158

Open jredbeard opened 1 year ago

jredbeard commented 1 year ago

Is there an existing issue for this?

New feature

As a CLI wallet user I'd like to be able to specify an RPC endpoint and still connect to it even if a .koinosrc file is present that contains a connect command.

Current behavior if a .koinosrc file is present and you use the -r option: 202759668-e1bbdae6-55a3-4727-b18b-c344f461bfe9

Once there is a global RC file implemented for system-wide package manager installs (separate related issue #157) then there will be no way around this and -r will never work for me because a .koinosrc file will always be loaded no matter what.

If a .koinosrc file is present in either the local or global locations and -r is specified a message should also be displayed saying Ignoring koinosrc file because an RPC endpoint was specified with -r

Anything else?

I believe that this should be only for the -r command line argument but could potentially just be all command line arguments.

It should skip loading the entire .koinosrc file because contract addresses specified in it may be incorrect if you are connecting to a different endpoint (and this helps to keep the app chain agnostic while still delivering a good user experience for average mainnet users).

koinos-ci commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

mvandeberg commented 1 year ago

Would adding a flag to skip loading of the rc file be sufficient?

jredbeard commented 1 year ago

@mvandeberg I think adding a flag to skip loading of the rc file would be a workaround but probably not a solution... especially if #157 is implemented for snap (or other pkg manager) installations.

Maybe an easier workaround that would satisfy this would be to just skip loading the .koinosrc altogether if any command line options are specified. (Forgive me if that suggestion isn't great for other implementation reasons, it's been months since I've looked at this but at a glance that seems logical)

lukemwillis commented 1 year ago

Combining this idea with https://github.com/koinos/koinos-cli/issues/187 -- you could add a section to .koinosrc to be run on "normal" start up.

[startup]:
  connect https://api.koinos.io

Then you would only run the startup section of .koinosrc when ./koinos-cli is invoked without command line args.

jredbeard commented 1 year ago

Combining this idea with #187 -- you could add a section to .koinosrc to be run on "normal" start up.

[startup]:
  connect https://api.koinos.io

Then you would only run the startup section of .koinosrc when ./koinos-cli is invoked without command line args.

So on this, even though I love #187 it doesn't really solve this issue. If we do #157 and there is a 'global' RC file then command line options will never work if they aren't ignored when you pass them. Think of the user experience: I install with snap or apt-get and try to connect to an endpoint with -r as a command line option - instead of doing what I expect, it just goes ahead and connects to main net / test net. It also works against being a chain agnostic framework imo.