---
updatedAt: 2025-06-03T20:36:33.000Z
agentTools:
  projectIndex: https://docs.ol-hub.com/llms.txt
---

# ol config hub

Create or update CLI environment

OpenLegacy CLI is pre-configured to work with a default target hub. However, you can set OpenLegacy CLI to a different target hub by running **ol config hub**. For example, you can switch between a QA target hub to a DEV target hub using **ol config hub**.

The **ol config hub** command usually writes the target hub settings in: 

* **Linux**: \~/.ol/cli/ol-cli-config.json
* **Mac OS**: \~/.ol/cli/ol-cli-config.json
* **Windows**: C:/Users/\<UserName>/.ol/cli/ol-cli-config.json

The **ol-cli-config.json** file stores the target hub settings in the following JSON object:

```
{
 "activeEnvName": "default_ol_env",
  "envs": {
    "default_ol_env": {
      "apiKey": "",
      "username": "",
      "targetHub": "",
      "sharedSecret": "changeme"
   },
     "my_custom_env": {
      "apiKey": "<another-api-key>",
      "username": "<another-username>",
      "targetHub": "http://another-hub-url",
      "sharedSecret": "another-shared-secret"
   }
}
```

## Syntax

 ol config hub ENVIRONMENT\_NAME \[OPTIONS]

## Arguments

**ENVIRONMENT\_NAME**

The name of the new target hub

## Options

**--source-env**

The target hub serves as a source of default values for a newly set target hub. Initially, the source-target hub is duplicated under the new target hub name, then the new **ol config hub** option values override the default values. However, if **--source-env** is not set, **default\_ol\_env** will be used as the source for default values.

**--api-key**

The api-key used for login to the target hub from the OpenLegacy CLI. See [Generating API keys](https://ol-hub.readme.io/docs/generating-api-keys)

**--username**

The username used for login to the target hub from the OL Hub Login page

**--hub-url**

The target hub URL

**--shared-secret**

An encryption key for encrypting sensitive information passed in the option values of [**ol add**](https://ol-hub.readme.io/docs/ol-add) and [**ol test connection**](https://ol-hub.readme.io/docs/ol-test-connection) commands. The encrypted information has to be decrypted before the application can use it on run-time. Therefore, ensure that you include the shared secret in your run-time application configuration.

**--active**

Set the target hub as the active target hub.

**trust-any-ssl**

Allow connection to the hub with self-signed SSL certificate.

**trust-signed-ssl**

Allow connection to the hub with signed SSL certificate.

## Examples

![](https://files.readme.io/b93df22-vertical_bar.png)  Setting a new target hub under the qa alias based on the test target hub and overriding the default api-key, username, and hub-url options.

```Text Windows
> ol config hub qa --source-env test --api-key adv38kigf --username my_username --hub-url https://api.dev.ol-hub.com/backend --shared-secret e34rtyq17
```
```Text macOS
$ ol config hub qa --source-env test --api-key adv38kigf --username my_username --hub-url https://api.dev.ol-hub.com/backend --shared-secret e34rtyq17
```

![](https://files.readme.io/95f8282-vertical_bar.png)   Updating the qa target hub with a new api key

```Text Windows
> ol config hub qa --api-key rqa17fmik
```
```Text macOS
$ ol config hub qa --api-key rqa17fmik
```

![](https://files.readme.io/95f8282-vertical_bar.png)   Changing the active target hub to qa

```Text Windows
> ol config hub qa --active
```
```Text macOS
$ ol config hub qa --active
```

![](https://files.readme.io/95f8282-vertical_bar.png)   Setting a new target hub under the alias prod based on the default\_ol\_env target hub with a new api-key, and making prod the active target hub.

```Text Windows
> ol config hub prod --api-key mYS00ZGY1 --active
```
```Text macOS
$ ol config hub prod --api-key mYS00ZGY1 --active
```