> For the complete documentation index, see [llms.txt](https://docs.laminar.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.laminar.run/advanced/storing-credentials-variables.md).

# Storing Credentials/Variables

Configurations in Laminar are key-value stores that manage environment-specific settings, credentials, and properties for workflows. They enable you to run the same workflow with different settings across environments or customers.

## Usage

To understand how configurations work, we'll use the completed example from [Getting Started](/getting-started.md).

Suppose we had different API base urls for each environment: `STAGING` and `PROD`. To be able to reuse the workflow with different variables, we would need to create two new configurations. To do so:

1. from the workflow editor, click on the **Select a configuration** dropdown
2. click on the New Configuration from the menu. It should bring up a configuration form
3. Fill out configuration form. Enter name, id and set of properties
4. \[OPTIONAL] Repeat steps 1 through 3 for the second configuration
5. Update step programs. Substitute the hardcoded value to abstract with the syntax `{{config.<configuration_property_key>}}` and save your changes.

**Example:**

```diff
(data) => {
    // The body of the request is the output from the previous step (step_1)
    const requestBody = data.step_1.data;

    return {
        "lam.httpRequest": {
            "method": "POST",
-           "url": "https://shipping-logistics-loic21.replit.app/api/orders",
+           "url": "{{config.shipping_api_base_url}}",
            "headers": {
                "Content-Type": "application/json"
            },
            "body": requestBody
        }
    };
}
```

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeyfSRRmLEurvKZJcO0Tg%2Fuploads%2FM3X30nrHPRqJs95piX1g%2FCreating%20CONFIG.mp4?alt=media&token=06e80604-d1f8-4d49-b0a9-5f11f140a779>" %}

To run the workflow with a specific configuration, make sure you select the right configuration from the editor before:

1. clicking on the **Run Workflow** button if triggering the workflow in-app
2. copying the workflow execution link if triggering workflow remotely

## **Dynamic configuration updates**

Dynamic configuration updates allow workflows to adapt to changing data and scenarios on the fly. With the `lam.updateConfig` operation, you can seamlessly modify configuration settings directly from a flow. \
This flexibility is crucial for maintaining an agile workflow environment. \
For example, you can update a configuration with the latest processing timestamp or dynamically adjust thresholds, ensuring your workflow remains responsive and efficient. By setting `createIfNotExists` to true, you can also ensure new configurations are automatically created if they don't already exist, further enhancing your system's adaptability.<br>

```javascript
(data) => {
  const { input } = data;

  return {
    "lam.updateConfig": {
        "configurationId": "my-config",
        "properties": [
          {
            "key": "lastProcessedTimestamp",
            "value": new Date().toISOString()
          },
          {
            "key": "recordCount",
            "value": "1500"
          }
        ],
        "createIfNotExists": true,
        "configurationName": "Auto-generated Config"
      }
    }
};
```
