Skip to content

Variables

Overview

Variables in the AP are named key-value pairs that you can define once and reuse across your data pipelines, integrations, and configurations. They are especially useful for managing values that change between environments, like development, staging, and production, or that are used repeatedly in different workflows, such as database credentials and API tokens.

The variables page in AP provides a central location where you can create, update, and view all available variables in your workspace. Each variable has a name and a corresponding value, and once defined, it can be referenced anywhere in your configuration using the ${VARIABLE_NAME} format. For example, referencing ${DB_USERNAME} in a connection or script will automatically substitute the value of the DB_USERNAME variable at runtime.

Variables can be either plain or secure. Secure variables are always hidden from logs and user interfaces to protect sensitive information. To mark a variable as secure, check the secure checkbox when creating or editing it. This is recommended for variables that contain secrets like passwords, API keys or access tokens. Plain variables, on the other hand, are visible in the interface and logs and are suitable for non-sensitive values such as configuration flags or environment labels. Both secure and plain values are encrypted at rest.

Using variables in AP brings several benefits. It reduces duplication by allowing you to define a value once and reuse it everywhere. It also enhances security by minimizing the risk of exposing sensitive values in logs or user interfaces. Most importantly, it makes your workflows more portable and easier to maintain, as if a value changes, you only need to update it in one place.

Variable list

Manage variables

The following section covers how to view, create, and remove variables.

View variables

  1. Click Variables to list all variables.

Create variable

  1. Enter the following information in the input fields at the top of the page.

    Field Description
    Name Variable name
    Value Variable value
    Secured Whether to always hide the value
  2. Click Create.

Update variable

  1. Find the variable to edit in the list.
  2. Click the Update icon next to the variable.
  3. Edit the variable name or value.
  4. Click the Done icon next to the variable.

Remove variable

  1. Find the variable to remove in the list.
  2. Click the Remove icon next to the variable.

Example

  1. Click Variables.
  2. Create a variable with name DHIS2_HQ_USERNAME with the name of a DHIS2 user account.
  3. Click Data catalog.
  4. Create or edit a DHIS2 data pipeline.
  5. Click Web API.
  6. In the Username field, enter ${DHIS2_HQ_USERNAME}.
  7. Click Save.