Configure CLI

tawonctl can be configured through:

  • command line arguments

  • using a configuration file

    • tawonctl will automatically look for a config file named tawonctl.yaml in the folder where the command is invoked.

    • you can pass the path of the config file with the --config myconfig.yaml flag.

  • environment variables

Example 1. Setting Tawon Controller address

You can set the address of the Tawon Controller with:

  • a flag on the command line (--addr http://…​)

  • a YAML config file, and the addr: http://…​ option:

    • in a config file (tawonctl.yaml) in the same folder you are calling tawonctl

    • by passing the --config param with the path to the yaml config file

  • with the TAWONCTL_ADDR environment variable

For example, using the environment variable:

export TAWONCTL_ADDR="https://tawon.xmantis.net"
tawonctl machines
sh

Command line flags

The easier way to configure is through simple command line arguments. To find command line arguments and subcommand, invoke help with:

tawonctl --help
sh

And for subcommand arguments like so:

tawonctl machines --help
sh

YAML configuration file

The configuration file should be written in YAML syntax. The arguments are the same as the command line flags, where dots (.) are expanded to objects, like so:

tawonctl directives --log.level debug --log.json
sh

would become:

log:
  level: debug
  json: true
yaml

Environment variables

Environment variables also align with command line flags. They are capitalized, prefixed with TAWONCTL_ and dots (.) are replaced by underscores (_). So:

tawonctl directives --log.level debug --log.json
sh

would become:

TAWONCTL_LOG_LEVEL=debug TAWONCTL_LOG_JSON=true tawonctl directives
sh