# 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"
      }
    }
};
```


---

# Agent Instructions: 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:

```
GET https://docs.laminar.run/advanced/storing-credentials-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
