Managing multiple profiles

The CLI supports storing and switching between profiles, each with their own configurations, including the account name. After the initial setup of the CLI and successfully authenticating your Decodable account, you have a single profile - used by default for all CLI commands - in the configuration file ~/.decodable/config.

This file may look like this:

version: 1.0.0
active-profile: default

profiles:
  default:
    account: my-account

This configuration describes the most basic setup, a single profile named default referencing the Decodable account my-account which is currently set as the active-profile.

Adding additional profiles

Open the CLI configuration file ~/.decodable/config in your favorite text editor and add another profile entry under the profiles section in the YAML file, using a new profile name of your choice and referencing another Decodable account you have access to.

The example below uses demo as the profile name and references a Decodable account named my-demo-account.

version: 1.0.0
active-profile: default

profiles:
  default:
    account: my-account
  # additional profile named "demo" referencing the "my-demo-account"
  demo:
    account: my-demo-account
You can add as many profiles with unique names as necessary to be able to use the CLI across several Decodable accounts that are accessible to you. Almost any CLI command allows to add the -p <profile_name> option to specify the profile you want to use for that command.

Sign in to accounts referenced in profiles

To sign in to another account that’s referenced via an existing profile in your CLI configuration file run decodable login -p <profile_name>.

Using the example from above, you would run decodable login -p demo which will prompt you to sign in to the my-demo-account Decodable account. Follow the screen instructions in your terminal / browser to complete the login process.

After a successful login, the CLI will add a corresponding profile entry named demo in the authentication file ~/.decodable/auth that contains the tokens to access the my-demo-account account.

version: 1.0.0
tokens:
    default:
        access_token: ...
        refresh_token: ...
        id_token: ...
        expiry: ...
    # added after login to the account referenced by the "demo" profile
    demo:
        access_token: ...
        refresh_token: ...
        id_token: ...
        expiry: ...

Listing available profiles

You can list all profiles and see which one is currently active (that’s used by default), by running:

decodable config profile list

# Output:
#
# profile name         account              active
# default              my-account           true
# demo                 my-demo-account      false

Activating a profile

At any given time, one CLI profile is active and used by default. You can switch the active profile by running decodable config profile activate <profile_name>. Doing so, will set the specified profile as the default for all CLI commands going forward.

To activate the demo profile added previously, you’d run decodable config profile activate demo. If you then run decodable config profile list, you will see that the demo profile is now marked as active:

decodable config profile list

# Output:
#
# profile name         account              active
# default              my-account           false
# demo                 my-demo-account      true

Override the profile for a command

By default, commands use whichever profile is marked as the currently active profile. Instead of switching the active profile, you can only override the profile used when running a specific command by adding the -p <profile_name> option.

Examples:

  • list all connections in the profile named demo:

decodable connection list -p demo
  • activate a specific pipeline in the profile named default:

decodable pipeline deactivate <pipeline id> -p default