Skip to content

📝 Configuration

coccoinomane edited this page Mar 31, 2023 · 8 revisions

web3cli should work out of the box for most cases. Sometimes however the need may arise to change its default behaviour. This is done by changing its configuration settings.

How to change a setting

web3cli reads its settings from three places, in this order of priority:

  1. From environment variables
  2. From the web3cli.yaml file in the working directory
  3. From the web3cli.yaml file in your your home folder, more precisely $HOME/.web3cli/config/web3cli.yaml

If the same setting is present in both configuration files, the one in the working directory wins. Similarly, a setting specified via an environment variable wins on either config file.

List of available settings

Please refer to the example configuration file for a list of all settings that can be changed.

Environment variables

All settings can be overridden via environment variables.

For example, the default_chain settings can be overridden by setting the env variable WEB3CLI_DEFAULT_CHAIN:

WEB3CLI_DEFAULT_CHAIN=avax w3 chain get # output: avax

Edit configuration files

You can edit the configuration files using w3 config.

For example, run w3 config set default_chain avax to set Avalanche as the default chain. This will modify the web3cli.yaml file in your home folder.

To modify the config file in the working directory, add the --no-global flag. Remember that local settings always win over global ones.

Show current settings

To show the whole configuration that will be used by web3cli, run w3 config get.

To show a specific setting, just add the setting name: w3 config get default_chain