Skip to main content

Configuration via environment variables

Configuration via environment variables

One way to configure the CLI is to use environment variables. CLI configuration has the following order of precedence: flags > environment variables > configuration file > defaults. Note that required values must be set via any of the configuration methods.

General configuration
  • COMPUTESPHERE_API_V2_URL : The URL of the ComputeSphere API. Defaults to https://api.computesphere.com/v2 Interchangeable with 'api.base_v2' configuration.
  • COMPUTESPHERE_OIDC_ISSUER : The sign-in address. Defaults to the one that belongs to the API URL. Interchangeable with 'oidc.issuer' configuration.
  • COMPUTESPHERE_API_TOKEN : The API token to use for authentication. Interchangeable with 'api.token' configuration.
  • COMPUTESPHERE_PROJECT_ID : The ID of the project to use. Interchangeable with 'common.project' configuration or '--project' flag.
  • COMPUTESPHERE_APPLICATION_ID : The ID of the application to use. Interchangeable with 'common.application' configuration or '--application' flag.
  • COMPUTESPHERE_OUTPUT : The output format to use: 'table', 'plain', 'json', 'yaml', and 'csv'. Defaults to 'table'. Interchangeable with 'common.output' configuration or '--output' flag.
  • COMPUTESPHERE_LOG_LEVEL : The log level to use: 'trace', 'api', 'debug', 'info', 'warn', 'error', 'fatal', 'panic', and 'disabled'. Set to 'api' to additionally log details of HTTP traffic. Interchangeable with 'logging.level' configuration. Has bigger precedence than COMPUTESPHERE_DEBUG.
  • COMPUTESPHERE_DEBUG : Set to 'true' to enable debug mode. Interchangeable with 'logging.debug' configuration or '--debug' flag.

Color output ComputeSphere follows the convention for ANSI colors [https://bixense.com/clicolors]. Variables are listed in order of precedence. The CLI will use the first value it finds.

  • NO_COLOR : Set to any value to avoid printing ANSI color codes.
  • CLICOLOR_FORCE : Set to any value to force color output, even when the output is piped.
  • CLICOLOR : Set to '0' to disable color output.
  • COMPUTESPHERE_NO_COLOR : Set to 'true' to disable color output for the CLI specifically. Interchangeable with '--no-color' flag and 'io.no-color' configuration.
Interactive mode
  • COMPUTESPHERE_NO_INPUT : Set to 'true' to disable interactive mode. Interchangeable with '--no-input' flag and 'io.no-input' configuration.
  • COMPUTESPHERE_FORCE_TTY : Set to any value to force interactive mode even when the output is redirected. When the value is a number, it is interpreted as the number of columns available in the viewport.

Examples​

export COMPUTESPHERE_API_V2_URL=https://api.computesphere.com/v2
export COMPUTESPHERE_API_TOKEN=your-api-key
export COMPUTESPHERE_PROJECT_ID=your-project-id
export COMPUTESPHERE_OUTPUT=yaml
export COMPUTESPHERE_LOG_LEVEL=api
export COMPUTESPHERE_NO_COLOR=true
export COMPUTESPHERE_NO_INPUT=true

See also​