bitcoin-cli: Choose wallet through environment variable #15097

issue domob1812 opened this issue on January 4, 2019
  1. domob1812 commented at 7:22 AM on January 4, 2019: contributor

    Multi-wallet support is a very nice feature. However, it makes using bitcoin-climanually a bit cumbersome, as one always has to type -rpcwallet=foo for each command.

    What do you think of allowing to choose the wallet through an environment variable, e.g. BITCOINCLI_WALLET? In other words, if -rpcwallet is not specified but this variable is set, use the wallet specified in the variable. That way, the wallet could be chosen once e.g. in a shell session and then shorter commands could be used in the follow-up.

    Of course, this only applies to explicit manual usage of bitcoin-cli. Programmatic users (either using the RPC interface directly or calling bitcoin-cli) do not really have any benefit from such a change. Also, as an alternative, one can use a shell alias instead. But I think it might still be nice to have this (from my own experience). If others agree, I'm happy to implement this.

  2. fanquake added the label Wallet on Jan 4, 2019
  3. promag commented at 7:25 PM on January 28, 2019: member

    IMO arguments are more user friendly, even for auto complete etc.

    What if both are specified? Honestly why create redundancy?

    More importantly, I think it would be prone to mistakes (missing change env, hard to understand from bash history, etc..).

  4. domob1812 commented at 6:49 AM on January 29, 2019: contributor

    IMO arguments are more user friendly, even for auto complete etc.

    They are more explicit, but require retyping every time.

    What if both are specified? Honestly why create redundancy?

    I imagine the explicit argument would override the environment variable.

    More importantly, I think it would be prone to mistakes (missing change env, hard to understand from bash history, etc..).

    That is a fair point.

    I personally would have liked something like that a couple of times in shell sessions, that's why I decided to bring up the idea. Honestly, though, I could probably just as well have used a bash alias instead of an environment variable in those situations. So I don't have a strong opinion here, either.

  5. jarolrod commented at 3:04 AM on January 14, 2021: member

    @domob1812 can this be closed. I agree with @promag that arguments are better in this scenario. And as you mentioned, you can always use a bash alias

  6. domob1812 commented at 5:44 AM on January 14, 2021: contributor

    Yes sure, of course.

  7. domob1812 closed this on Jan 14, 2021

  8. DrahtBot locked this on Aug 18, 2022
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me