Skip to content

Helpful CLI configurations

The following commands require a session

Check the Quickstart guide on how to login.

Overview

KSDK cli tool can be further configured to provide an enhanced experienced to the user. Several configurations ranging from an active verbose mode to the output type can be adjusted to the user's need.

All Configurations

All the available configurations can be consulted with the kelvin configuration list command:

kelvin configuration list

Success

[kelvin.sdk][2020-06-03 16:04:04][I]                                                                                                                                                                          
*************************** Environment Variables ***************************                                                                                                                                                                                                                                                                                        
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------+-----------------+                                                                                                                                                                                  
| Variable                          | Description                                                                                                               | Current Value   |                                                                                                                                                                                  
|-----------------------------------+---------------------------------------------------------------------------------------------------------------------------+-----------------|                                                                                                                                                                                  
| KSDK_VERSION_WARNING              | If outdated, KSDK will warn the user. If the minimum version is not respected, it will block any operation until upgrade. | True            |                                                                                                                                                                                  
| KSDK_DOCKER_IMAGE_VERSION_WARNING | Will warn the user if the base docker image present on the `app.yaml` is deprecated.                                      | True            |                                                                                                                                                                                  
| KSDK_VERBOSE_MODE                 | If set to True, will activate --verbose mode by default on every command.                                                 | False           |                                                                                                                                                                                  
| KSDK_OUTPUT_TYPE                  | Sets the output type: KSDK, JSON or KEY_VALUE                                                                             | KSDK            |                                                                                                                                                                                  
| KSDK_COLORED_LOGS                 | If disabled, all logs will be output in the default OS color, ready to be captured.                                       | True            |                                                                                                                                                                                  
| KSDK_SHELL                        | Enable built-in command shell.                                                                                            | False           |                                                                                                                                                                                  
| KSDK_TABLE_FORMAT                 | Set the table format for all data display operations. Check "tabulate" pypi page.                                         | psql            |                                                                                                                                                                                  
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------+-----------------+         

KSDK version warning

KSDK will, by default, warn the user if its version is either outdated or unsupported:

[kelvin.sdk][2021-03-22 14:00:31][I]                                                                                                                                                                                                                      

                    A new version of the SDK is available! 5.1.0 → 5.1.1                                                                                                                                                

                    Changelog: https://docs.kelvininc.com                                                                                                                                                                                             

                    Run pip3 install kics --upgrade to update                                                                                                                 

                    And log in again with kelvin auth login <url>.                                                                                                                                                                                    

Despite upgrading being highly recommended, one can still use the outdated version by disabling the version warning:

Success

➜ kelvin configuration set KSDK_VERSION_WARNING False                                                                                                                                                                                                     
[kelvin.sdk][2021-03-22 13:51:55][R] Successfully set "KSDK_VERSION_WARNING" to "False"    

Base image version warning

Similar to the KSDK version, when building an application with an outdated base image, the user will be warned.
This warning can be toggled:

Success

➜ kelvin configuration set KSDK_VERSION_WARNING False                                                                                                                                                                                                     
[kelvin.sdk][2021-03-22 13:51:55][R] Successfully set "KSDK_VERSION_WARNING" to "False"    

Verbose mode

In order to keep the logs short, by default, verbose mode is disabled. The user can enable the verbose mode in order to get a more detailed stacktrace:

Success

➜ kelvin configuration set KSDK_VERBOSE_MODE True                                                                                                                                                                                                     
[kelvin.sdk][2021-03-22 13:51:55][R] Successfully set "KSDK_VERBOSE_MODE" to "True"    

Configuring the output type

By default, KSDK outputs in its own colored-structure format. This is the format used all through documentation. In order to improve integration with third-party tools and processes, json and key value output types have been added:

# kelvin configuration set KSDK_OUTPUT_TYPE <KSDK|JSON|KEY_VALUE>
kelvin configuration set KSDK_OUTPUT_TYPE KEY_VALUE

Success

➜ kelvin configuration set KSDK_OUTPUT_TYPE "KEY_VALUE"                                                                                                                                                    
[kelvin.sdk][2020-06-03 16:36:02][R] Successfully set "ksdk_output_type" to "KEY_VALUE".  

From then on, all output will have the following format

> kelvin app create new-app
event='Creating new application "new-app".' logger='kelvin.sdk' level='info' timestamp='2020-06-03 16:41:25'                                                                                                  
event='Successfully created new application: "new-app".' logger='kelvin.sdk' level='relevant' timestamp='2020-06-03 16:41:25'          

Setting/Unsetting Configurations

Configurations can be set with the kelvin configuration set command:

# kelvin configuration set <variable> <value>
kelvin configuration set KSDK_VERSION_WARNING_ENABLED True

Success

[kelvin.sdk][2020-07-27 18:13:51][R] Successfully set "ksdk_docker_image_version_warning_enabled" to "True".           

Similarly, configurations can be unset with the kelvin configuration unset command:

# kelvin configuration unset <variable> <value>
kelvin configuration set KSDK_VERSION_WARNING_ENABLED True

Success

[kelvin.sdk][2020-07-27 18:14:42][R] Successfully unset "ksdk_docker_image_version_warning_enabled".      

Setting configurations with Environment Variables

KSDK configurations can also be set with environment variables with the same name. Configurations set through environment variables will override their values configured through the kelvin configuration set command.

For example, the following command will enable the verbose mode for all commands.

kelvin configuration set KSDK_VERBOSE_MODE_ENABLED True

But if that same configuration were to be set to False through an environment variable, it would then override the previously defined verbose mode.

export KSDK_VERBOSE_MODE_ENABLED False