Configuration
Note
This document covers how to configure argus-cli. Most of the configuration is done out of the box, but in some cases you might want to do some more configuration.
Setting up a local config file
The toolbelt looks for a local config file called .argus_cli.yaml
in your home directory.
touch ~/.argus_cli.yaml
chmod 600 ~/.argus_cli.yaml
Using a different configuration file
To use a configuration file in a different location than the default, set the
ARGUS_CLI_SETTINGS
environment variable to the path of the configuration file
you want to use.
Config fields
Argus API
All argus_api
options exist under the api
field in the configuration file.
Alternative API URL
To add your own custom Argus URL, use the api_url
parameter.
The default value is https://api.mnemonic.no
.
api:
api_url: "Your API URL"
Authentication
To use some functions in the API you’ll have to be authenticated.
This can for example be done by SMS confirmation, username and password or API keys. It is strongly recommended to use an API key.
API Key
api:
api_key: <Your API Key>
method: apikey
Username and password
api:
username: <Your username>
password: <Your password>
method: username
Timeout
By default, Argus API requests will timeout after 30 seconds.
This can be changed by changing the value of the timeout
option to the desired
timeout value in seconds.
api:
timeout: 30
alternatively, the ARGUS_API_TIMEOUT
environment variable can be used. If the
configuration file and the environment variable set different values, the one provided
through the environment variable will be used.
Argus CLI
Logging
The toolbelt utilizes Python’s built in logging system. This has it’s own config format. To get more information about it look at the python logging documentation.
Changing logging level
The following is how to change the logging level of the program. Examples are
DEBUG
, INFO
, WARNING
and ERROR
.
logging:
loggers:
argus_api:
level: <LOGGING LEVEL>
argus_cli:
level: <LOGGING LEVEL>
Environments
In some cases, you might want to change between different configuration environments. For example, you might want to use a different API key for some special scripts. This is where environments come in.
In an environment, you’ll be using the baseline config that you’ve defined at the top level as a base, and work on top of that. Any keys you specify will be overwritten, others will be used as is.
These environments exist under the environment.<name> tag in your config, and can be used with the –environment option in the cli.
environments:
test:
api:
api_key: 123/45/abcdefg
method: apikey
With this example, you can use your environment like this:
argus-cli --environment test <your command here>
Includes
The configuration file supports includes using the !include /path/to/file.yaml
syntax.
The included files will be loaded from $HOME/.argus_cli.d
by default, which can
be changed by setting ARGUS_CLI_SETTINGS_INCLUDES
.
Any keys in the included file will be included at the level of the include statement.
Example :
api:
api_url: https://api.mnemonic.no
api_key: my/api/key
method: apikey
jira: !include credentials/jira_credentials.yaml
username: AzureDiamond
password: hunter2
api:
api_url: https://api.mnemonic.no
api_key: my/api/key
method: apikey
jira:
username: AzureDiamond
password: hunter2
Environment variables
- ARGUS_CLI_SETTINGS
location of the configuration file. If set, will override the default of
$HOME/.argus_cli.yaml
.
- ARGUS_CLI_SETTINGS_INCLUDES
directory from which to load configuration includes. If set, will override the default of
$HOME/.argus_cli.d
.
- ARGUS_API_TIMEOUT
timeout value (in seconds) for requests to the Argus API. Default to
30
.