Manage gdcloud CLI configurations

A configuration is a named set of Distributed Cloud Hosted gdcloud CLI properties. These properties are key-value pairs, organized in sections, that govern the behavior of the gdcloud CLI.

Properties that are commonly stored in configurations include the organization console URL and project ID. Configurations allow you to define and enable these and other settings together as a group.

Configurations are stored in your user config directory, typically ~/.config/gdcloud on macOS and Linux. Also, note that the config directory must be write-enabled.

If you have multiple configurations, you can choose to switch between them. For more about switching configurations, refer to the section on Activate a configuration.

To read about configurations from the command-line and a complete list of available properties and the sections they are in, run gdcloud topic configurations.

Default configuration

The gdcloud CLI initially creates a single configuration named default. You can set properties in your configuration by running the gdcloud init command or by running gdcloud config set directly.

Multiple configurations

The single default configuration is suitable for many use cases. However, you can also create additional configurations and switch between them as required using gdcloud config configurations activate. The initial default configuration is created as a convenience, and is not required to use. You can name this and any additional configurations however you'd like.

Multiple configurations are useful if you want to:

  • Use multiple projects: You can create a separate configuration for each project and switch between them as required.
  • Use multiple organization console URLs.
  • Perform generally independent tasks: For example, you can use one configuration to work on service A in one project and manage an unrelated service B in another project.

Create a configuration

To create a configuration, run:

gdcloud config configurations create NAME

You must activate the new configuration after creation to use it.

Activate a configuration

Only one of your multiple configurations can be active at a given time. The active configuration is the configuration whose properties will govern the behavior of the gdcloud CLI.

To activate a new configuration or switch to a new active configuration, run:

gdcloud config configurations activate NAME

gdcloud config list will always displays you the properties in your active configuration.

List configurations

To list the configurations in your gdcloud CLI, run:

gdcloud config configurations list

The gdcloud CLI lists the configurations and shows which configuration is active:

default             False      example-project-default
config-project-1    False      example-project-1
config-project-2    False      example-project-2

Setting configuration properties

To set and unset the properties in the active configuration, run:

gdcloud config set project PROJECT

Viewing configuration properties

To view the properties in a configuration, run:

gdcloud config configurations describe NAME

The gdcloud CLI prints the configuration properties:

is_active: false
name: default
    screen_reader: "false"
    insecure_skip_tls_verify: "false"
    login_config_cert_path: /tmp/root-web-tls-ca.cert
    project: example-project

To view properties in the active configuration, run:

gdcloud config list

Delete a configuration

To delete a configuration, run:

gdcloud config configurations delete NAME

You can't delete an active configuration. To switch to another configuration before deleting, use gdcloud config configurations activate if required.