# Globals

## **Overview**

Globals are variables stored in the Platform that can be reused across multiple [pipelines](https://docs.digibee.com/documentation/developer-guide/development-cycle/build-overview/pipelines) and [capsules](https://docs.digibee.com/documentation/developer-guide/development-cycle/build-overview/capsulas). After creating a Global variable, you can reference it in any text field within connector configuration forms.

This feature accelerates development: by updating the value of a Global in one place, the change is applied everywhere the variable is used.

{% hint style="info" %}
Globals are updated automatically only in pipelines that have not yet been deployed. If a pipeline using the updated variable is already deployed, a warning appears on its card in the [**Run**](https://docs.digibee.com/documentation/developer-guide/development-cycle/overview) page to remind you to redeploy it.
{% endhint %}

## **Managing globals**

<figure><img src="https://content.gitbook.com/content/jvO5S91EQURCEhbZOuuZ/blobs/L4NAgfIkYUPjyGhzQAg6/globals-page.png" alt="Globals page where you can create, view, edit, and delete Global variables."><figcaption><p>Configuration page for adding a new global in the Platform.</p></figcaption></figure>

### **Creating a global**

1. On the Build page, click the **Globals** tab.&#x20;
   1. Alternatively, click **Settings** in the upper-right corner of the Platform home page and select **Globals** on the next page.
2. Click **Create** and fill in the fields:
   * **Global name:** The variable name to be referenced in pipelines or capsules. Use lowercase only, up to 60 characters, with letters, numbers, `-`(hyphen), or `.`(dot). Accents are not allowed.
   * **Category:** Defines how the value will be validated:
     1. **URL:** Must be a valid URL.
     2. **JDBC:** Must be a valid connection string.
     3. **Email:** Must be a valid email address.
     4. **ID:** Must contain only numbers.
     5. **Other:** Accepts any value. Use this option for lists, but avoid sensitive information (no encryption available).
3. **Description:** A short explanation of the Global’s purpose.
4. **Project Availability**: Define if the account can be used in all projects or only in selected ones. On the Globals listing page, you will only see globals available to all projects or the ones you have permission to access.

{% hint style="danger" %}

#### **Globals can be permanently removed from pipelines**

Pipelines can only use Globals that are available in their project. A Global is **removed from a pipeline** in the following situations:

* When a pipeline is moved to another project and the Global is not allowed in the destination project.
* When the **Project Availability** setting of a Global is updated and the project that contains the pipeline is removed from the allowed list.

Once a Global is removed in any of these situations, moving the pipeline back or allowing the project again **won't restore it**, for security reasons. In such cases, you must manually add each Global to the pipeline again.
{% endhint %}

5. **Prod environment / Test environment / Other environments:** Provide the value for each environment (up to 10,000 characters per field).
6. Click **Save**.
7. A confirmation window appears. Type “I want to create the global” in the **Confirmation message** field and click **Create**.

{% hint style="danger" %}
Globals are visible to all users with access and are not encrypted in the database. Don’t add sensitive data. Use [Accounts](https://docs.digibee.com/documentation/developer-guide/platform-administration/settings/accounts) if encryption is required.
{% endhint %}

### **Editing a global**

To edit an account, go to the **Globals** page and click the **pencil icon** in the **Actions** menu.

You can:

* Update the category.
* Update the description.
* Mark the global as deprecated. [Learn more about deprecating a global.](#deprecating-a-global)
* Define new rules for **Project Availability**.
* Edit the environment values.
* View all pipelines that use the global.

{% hint style="info" %}
Note that if the global is edited, any deployed pipelines must be redeployed to apply the changes.
{% endhint %}

After editing the global, a confirmation window appears. Type “I want to edit the global” in the **Confirmation message** field and click **Edit**.

All changes are applied immediately to pipelines that use the global and have not yet been deployed.

### **Deprecating a global**

Deprecating a global makes it unavailable for new pipelines or new pipeline versions. Existing deployments will keep working unless redeployed.

To deprecate a global:

1. Open the **Globals** page and click the **pencil icon** next to the account.
2. Enable the **Deprecated** toggle.
3. Click **Save**.

{% hint style="danger" %}
This action is irreversible.
{% endhint %}

### **Deleting a global**

Deleting a global permanently removes it from the Platform. You cannot delete globals that are currently used in pipelines, whether deployed or not. To proceed, remove or replace the global in all pipelines before deleting it.

To delete an account:

1. Open the **Global** page.
2. Click the **trash icon** next to the account.
3. Click **Delete** in the confirmation window.

### **Using globals**

Globals can be referenced in any text field within a connector’s configuration form.

To use a Global:

1. Open the pipeline or capsule.
2. Select the connector you want to configure.
3. In the target field, start an expression with `{{`. From the [autocomplete list](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/double-braces/double-braces-autocomplete), choose **`global`**, then type a dot (`.`) to display the available variables.

You can also insert the reference manually:

```
{{global.GlobalName}}
```

Replace **GlobalName** with the name you assigned when creating the Global. For example:&#x20;

```
{{global.db-timeout}}
```

Example: The Database URL parameter in the [**DB V2**](https://app.gitbook.com/s/EKM2LD3uNAckQgy1OUyZ/connectors/structured-data/db-v2) connector supports globals. As you begin typing the expression, the autocomplete feature displays the available variables, allowing you to select and use the one you configured.

<figure><img src="https://866970526-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjvO5S91EQURCEhbZOuuZ%2Fuploads%2FF9iGrNVXFu1Rfo94WRlC%2Fuse-global.gif?alt=media&#x26;token=1330bf1d-1b32-4413-ac33-5f9ba0568e2f" alt=""><figcaption></figcaption></figure>
