# Custom Connection: Set Environment Variables Documentation Missing

**URL:** <https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129>\
**Category:** Get Help\
**Tags:** configuration, management-api, connections\
**Created:** [October 11, 2021, 2:29pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129 "2021-10-11T14:29:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduardo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eduardo/32/9385_2.png) [@eduardo](https://community.auth0.com/u/eduardo)\
**Post date:** [October 11, 2021, 2:29pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129/1 "2021-10-11T14:29:55Z")

</div>

Good day.  
We noticed, that while there is an endpoint to [set configuration values for the rules](https://auth0.com/docs/api/management/v2#!/Rules_Configs/put_rules_configs_by_key), there is no endpoint to set environment variables for custom connections.

While this is not a blocker, I’d like to know if there is workaround by using the [update connection endpoint](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id), to see if we can manually set the configuration key values with expected encryption, such as bcrypt.

The only post that talks about document this in more depth is an issue for the auth0 deployment cli tool:

> <https://github.com/auth0/auth0-deploy-cli/issues/197>
>
> I'd be nice to document and include \`options.configuration\` in a custom DB conne…ction script example, to show how to provide configuration values (secrets), and clarify in the docs that these values aren't exported.

I was unable to find any documentation regarding configuration variables and best practices to deploy them through the management api.

Any leads or help to set this configuration values via Management API will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 11, 2021, 3:22pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129/3 "2021-10-11T15:22:46Z")

</div>

Hi @eduardo,

Thanks for reaching out to the Auth0 Community!

There are a couple of ways to set the configuration values for your Custom Database Connection.

The first way uses the Auth0 Management API to call the [update connection endpoint](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id), as you hinted.

Here is a sample body request that you can use to update with the configuration Key, Value pair:

```auto
{
  "display_name": "mycustomdb",
  "options": {
    "enabledDatabaseCustomization": true,
    "configuration": {
        "MY_KEY": "MY_VALUE"
    }
  }
}

```

Alternatively, you could use the Auth0 Dashboard and navigate to [Authentication \> YOUR\_DB \> Custom Database](https://manage.auth0.com/#/connections/database/) and setting the Key, Value pair manually in the database settings.

Hoped this helps! Please let me know if there are any questions.

Thank you.

---

<div class="post-metadata">

**Author:** ![eduardo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eduardo/32/9385_2.png) [@eduardo](https://community.auth0.com/u/eduardo)\
**Post date:** [October 11, 2021, 3:28pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129/4 "2021-10-11T15:28:47Z")

</div>

Hey, thanks for the swift response Reuben!  
I have a couple of follow up questions.

1. Do the values follow a certain encryption/hashing strategy?
2. Is this something that we could replicate “manually” when updating the values for the configuration key-value pairs? or is this something that can only be achieved by setting the values manually through the dashboard? Or is it sufficient to pass the configuration values without any kind of encryption.

The intention is to track these values in order to reliably regenerate the database in case we need to support other tenants.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 11, 2021, 5:03pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129/5 "2021-10-11T17:03:27Z")

</div>

Hi @eduardo,

Thank you for your response.

> [@eduardo](#):
>
> Do the values follow a certain encryption/hashing strategy?

Auth0 uses `bcrypt` for the encryption/hashing strategy.

> [@eduardo](#):
>
> Is this something that we could replicate “manually” when updating the values for the configuration key-value pairs? or is this something that can only be achieved by setting the values manually through the dashboard? Or is it sufficient to pass the configuration values without any kind of encryption.

After testing this further myself, there is no need to encrypt the value before updating the connection. I have corrected my previous example as well.

You can pass the Key, Value pair as plain-text to the endpoint, and Auth0 will automatically encrypt these values using `bcrypt`. After making these changes, I verified that the values are encrypted by calling the [**Get a connection**](https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id) endpoint.

Please let me know how this works for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 8, 2021, 6:44pm UTC](https://community.auth0.com/t/custom-connection-set-environment-variables-documentation-missing/71129/6 "2021-11-08T18:44:58Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
