ETCDEVTeam/emerald-vault-archive

EMERALD_CHAIN env var default not getting set

Closed this issue · 3 comments

~/dev/etc/emerald-cli master= ⟠ emerald list
Invalid arguments.

Usage:
  emerald server    [--port=<port>] [--host=<host>] [--base-path=<path>] [-v | --verbose] [-q | --quite]
  emerald new       --chain=<chain>  ([[--security-level=<level>] [--name=<name>] [--description=<description>]] | --raw <key>)
  emerald list      --chain=<chain>  [--show-hidden]
  emerald hide      --chain=<chain>  <address>
  emerald unhide    --chain=<chain>  ([-a | --all] | <address>)
  emerald strip     --chain=<chain>  <address>
  emerald import    --chain=<chain>  [-a | --all] [-f | --force] <path>
  emerald export    --chain=<chain>  ([-a | --all] | <address>) <path>
  emerald update    --chain=<chain>  <address> [--name=<name>] [--description=<description>]
  emerald transaction   --chain=<chain> <from> <to> <value> [--gas=<gas>] [--gas-price=<price>] [--data=<data>] (--nonce=<nonce> | --upstream=<upstream>)
  emerald balance   <address> [--upstream=<upstream>]
  emerald -V | --version
  emerald -h | --help
~/dev/etc/emerald-cli master= ⟠ echo $EMERALD_CHAIN
mainnet

Maybe other ENV_VARS not getting set? I didn't check anything else.

Possible dup #35 ?

r8d8 commented

@whilei, enviroment variables doesn't set by default.
Emerald-cli delegates that to user. One can set then in startup config for their OS, or use per command like this:
EMERALD_CHAIN=mainnet emerald list

Or I didn't get your point right?

I have set EMERALD_CHAIN=mainnet in my dotfiles as an env var, and expected emerald to use the global var EMERALD_CHAIN=mainnet value if I don't override it with --chain on the command line.

# Here I don't use '--chain' because I expect it to be system default from env var.
~  ⟠ emerald list
Invalid arguments.

Usage:
  emerald server    [--port=<port>] [--host=<host>] [--base-path=<path>] [-v | --verbose] [-q | --quite]
  emerald new       --chain=<chain>  ([[--security-level=<level>] [--name=<name>] [--description=<description>]] | --raw <key>)
  emerald list      --chain=<chain>  [--show-hidden]
  emerald hide      --chain=<chain>  <address>
  emerald unhide    --chain=<chain>  ([-a | --all] | <address>)
  emerald strip     --chain=<chain>  <address>
  emerald import    --chain=<chain>  [-a | --all] [-f | --force] <path>
  emerald export    --chain=<chain>  ([-a | --all] | <address>) <path>
  emerald update    --chain=<chain>  <address> [--name=<name>] [--description=<description>]
  emerald transaction   --chain=<chain> <from> <to> <value> [--gas=<gas>] [--gas-price=<price>] [--data=<data>] (--nonce=<nonce> | --upstream=<upstream>)
  emerald balance   <address> [--upstream=<upstream>]
  emerald -V | --version
  emerald -h | --help
~echo $EMERALD_CHAIN
mainnet
~  ⟠ env | grep EMERALD
EMERALD_CHAIN=mainnet
~  ⟠ cat ~/.dotfiles/etc/emerald.bash | grep CHAIN
export EMERALD_CHAIN=mainnet

Expected usage:

$ echo "export EMERALD_CHAIN=mainnet" >> ~/.dotfiles/etc/emerald.bash
$ source ~/.dotfiles/etc/emerald.bash
$ emerald list # <-- since no '--chain' flag given, use default env var value for 'EMERALD_CHAIN'
> 0xmymainnetaccounts
$ emerald list --chain=morden # <-- able to override default env chain setting
> 0xmytestnetaccounts

Does that make sense?

r8d8 commented

Ah, I see.
Now it makes sense, thanks.