> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-4-1/cybus-helm-charts/working-with-cybus-helm-charts/environment-variables.md).

# Configuring Environment Variables

Both the `connectware` and `connectware-agent` Helm charts let you set environment variables on containers using an `env` list of `name` and `value` pairs. Use this to pass runtime configuration that has no dedicated Helm value.

## When to Use

Use environment variables when you need to:

* Pass custom configuration flags not exposed as dedicated Helm values, such as debug options or feature toggles.
* Set an application-specific configuration.

{% hint style="warning" %}
Before using `env:`, check whether a dedicated Helm value already exists for the setting you need. The charts filter out environment variables that are controlled through Helm values, so setting them via `env:` has no effect. Use `env:` only for settings that have no corresponding Helm value.
{% endhint %}

## Configuration Values

The following Helm values control environment variables for each chart.

{% tabs %}
{% tab title="connectware Helm Chart Values" %}

| Value                   | Description                                                    |
| ----------------------- | -------------------------------------------------------------- |
| `${COMPONENT_NAME}.env` | Environment variables injected into the component's container. |
| {% endtab %}            |                                                                |

{% tab title="connectware-agent Helm Chart Values" %}

| Value                             | Description                                                         |
| --------------------------------- | ------------------------------------------------------------------- |
| `protocolMapperAgentDefaults.env` | Environment variables applied to all agent containers.              |
| `protocolMapperAgents[*].env`     | Environment variables applied to a specific agent's container only. |
| {% endtab %}                      |                                                                     |
| {% endtabs %}                     |                                                                     |

## Setting Environment Variables

{% tabs %}
{% tab title="connectware Helm Chart" %}
Set environment variables on each component individually. The `connectware` Helm chart does not provide a global `env` setting that applies to all Connectware components at once. To add environment variables to a component, set the `env` list under that component's configuration section.

The following example sets an environment variable on the `authServer` component:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
# Note: 'authServer' is used as an example, but this configuration
# is applicable to any Connectware component.
authServer:
  env:
    - name: MY_CUSTOM_VAR
      value: 'custom-value'
```

{% endcode %}

The environment variable is injected only into the `authServer` container. All other components are unaffected.
{% endtab %}

{% tab title="connectware-agent Helm Chart (Standalone)" %}
Use this tab if you deploy the `connectware-agent` Helm chart on its own. If you deploy it as a subchart of the `connectware` Helm chart, see the **connectware-agent Helm Chart (As Subchart)** tab instead.

### Setting Environment Variables for All Agents

To apply environment variables to all agents, add them to the `protocolMapperAgentDefaults` section of your `values.yaml` file:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
protocolMapperAgentDefaults:
  env:
    - name: CYBUS_TRUST_ALL_CERTS
      value: 'true'
protocolMapperAgents:
  - name: bender-robots
  - name: welder-robots
```

{% endcode %}

All agents inherit these environment variables unless overridden at the per-agent level.

## Setting Environment Variables for a Single Agent

To define environment variables for a specific agent, add the `env` list to that agent's entry in `protocolMapperAgents`:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
protocolMapperAgents:
  - name: bender-robots
    env:
      - name: CYBUS_TRUST_ALL_CERTS
        value: 'true'
      - name: CYBUS_LOG_LEVEL
        value: debug
```

{% endcode %}

These environment variables apply only to the `bender-robots` agent and do not affect other agents in the same Helm release.

## Unsetting Default Environment Variables for a Single Agent

If you have defined environment variables in `protocolMapperAgentDefaults`, you can remove them for a specific agent by setting `env` to an empty list (`[]`) in that agent's entry.

In the following example, `bender-robots` inherits the default environment variable, while `welder-robots` has its defaults cleared:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
protocolMapperAgentDefaults:
  env:
    - name: CYBUS_TRUST_ALL_CERTS
      value: 'true'
protocolMapperAgents:
  - name: bender-robots # inherits CYBUS_TRUST_ALL_CERTS from defaults
  - name: welder-robots # does not inherit any default environment variables
    env: []
```

{% endcode %}
{% endtab %}

{% tab title="connectware-agent Helm Chart (As Subchart)" %}
Use this tab if you deploy the `connectware-agent` Helm chart as a subchart of the `connectware` Helm chart. If you deploy it on its own, see the **connectware-agent Helm Chart (Standalone)** tab instead.

When deployed as a subchart, nest all `connectware-agent` values under the `connectwareAgent` key.

## Setting Environment Variables for All Agents

To apply environment variables to all agents, set them under `connectwareAgent.protocolMapperAgentDefaults`:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
connectwareAgent:
  protocolMapperAgentDefaults:
    env:
      - name: CYBUS_TRUST_ALL_CERTS
        value: 'true'
  protocolMapperAgents:
    - name: bender-robots
    - name: welder-robots
```

{% endcode %}

All agents inherit these environment variables unless overridden at the per-agent level.

## Setting Environment Variables for a Single Agent

To define environment variables for a specific agent, add the `env` list to that agent's entry under `connectwareAgent.protocolMapperAgents`:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
connectwareAgent:
  protocolMapperAgentDefaults:
    env:
      - name: CYBUS_TRUST_ALL_CERTS
        value: 'true'
  protocolMapperAgents:
    - name: bender-robots # inherits CYBUS_TRUST_ALL_CERTS from defaults
    - name: welder-robots
      env:
        - name: CYBUS_LOG_LEVEL
          value: debug
```

{% endcode %}

These environment variables apply only to the `welder-robots` agent and do not affect other agents in the same Helm release.

## Unsetting Default Environment Variables for a Single Agent

If you have defined environment variables in `protocolMapperAgentDefaults`, you can remove them for a specific agent by setting `env` to an empty list (`[]`) in that agent's entry.

In the following example, `bender-robots` inherits the default environment variable, while `welder-robots` has its defaults cleared:

{% code title="values.yaml" lineNumbers="true" %}

```yaml
connectwareAgent:
  protocolMapperAgentDefaults:
    env:
      - name: CYBUS_TRUST_ALL_CERTS
        value: 'true'
  protocolMapperAgents:
    - name: bender-robots # inherits CYBUS_TRUST_ALL_CERTS from defaults
    - name: welder-robots # does not inherit any default environment variables
      env: []
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Applying Configuration Changes

After editing your `values.yaml` file, apply the changes by running the `helm upgrade` command. For details, see [Applying Helm Configuration Changes](/2-4-1/cybus-helm-charts/working-with-cybus-helm-charts.md#applying-helm-configuration-changes).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cybus.io/2-4-1/cybus-helm-charts/working-with-cybus-helm-charts/environment-variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
