Advanced Toolbelt Configuration

Toolbelt's default configuration communicates with the stable Aunsight platform APIs out-of-the-box. Some users may need to adjust these settings to allow the tool to communicate with other backends, generally as a means of testing new features using the development platform APIs.

This article shows how to display Toolbelt's configuration settings and change them by means of a custom configuration JSON file. After reading this article, users should be able to create multiple configuration files for Toolbelt and employ shell aliases to invoke these different configurations. The instructions given here assume a Unix-based shell environment as is found on MacOS and Linux systems. Instructions for Windows PowerShell users will differ.

Displaying and Changing the Toolbelt Configuration

To display the configuration settings used by the Toolbelt, enter the command au2 context config in the terminal. This will display a table of key/value pairs. The data can also be displayed in JSON format by using the -R json option. Aunsight should display the following values by default:

Key Default Value Description
"AU_API_HOST" "" The RESTful API base URL
"AU_API_SOCKETIO_HOST" "" The SocketIO base URL.
"AU_CONTEXT_STORAGE_LOCATION" "/tmp/aunsight-token.json" File path for the session token.

In almost all instances, users will find these settings satisfactory for normal work. However, Toolbelt allows users to override these settings to change the default configuration. When run, Toolbelt checks if the environment variable AU_CONFIG_FILE points to an alternate JSON configuration file. If it does, it will attempt to use those for its configuration.

A Toolbelt configuration file must contain a validly-formatted JSON object with at least the three keys listed above. Since a common use case relies on the Aunsight development APIs (commonly used for beta testing new features before deployment), the example below gives those endpoints as the values for the configuration:

 "AU_API_HOST": "",
 "AU_CONTEXT_STORAGE_LOCATION": "/tmp/aunsight-token-dev.json"


In addition to the API endpoints, each configuration needs to store its context token in a separate file. Do not allow different configurations to overwrite the same context storage file.

After saving the configuration file to an appropriate location (for example, ~/.aunsight-toolbelt-dev-config.json), you can test the configuration by invoking Toolbelt with the shell environment variable set:

In Bash: AU_CONFIG_FILE="~/.aunsight-toolbelt-dev-config.json"; au2 context config

In Zsh: env AU_CONFIG_FILE="~/.aunsight-toolbelt-dev-config.json"; au2 context config

If the configuration file is valid, you will see Toolbelt display the same values you entered into the configuration file.

Using Shell Aliases to Automate Work

While users can specify a configuration file by means of an environment variable set with every call, those who frequently switch between configurations may wish to define shell aliases for their different Toolbelt configurations. Aliases can be created on MacOS/Linux systems by adding a line to shell configuration script on your system.

Assuming an alternate configuration file called .aunsight-toolbelt-dev-config.json and the desired alias name au2-dev, add the following lines to your shell configuration script:

  • For Bash shells put the following in ~/.bashrc: alias au2-dev="AU_CONFIG_FILE=~/.aunsight-toolbelt-dev-config.json au2"

  • for Zsh (default on MacOS Catalina), put the following in ~/.zshrc: alias au2-dev="env AU_CONFIG_FILE=~/.aunsight-toolbelt-dev-config.json au2"

Once you have saved the shell configuration script, restart your shell or re-evaluate the script to immediately add the alias to your running session: source ~/.bashrc (Bash) or source ~/.zshrc (Zsh)

You should now be able to invoke the Toolbelt with either the au2 command (default configuration) or by using the au2-dev alias to use the alternate configuration file.