> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/hosting/configuration/configuration-examples/encryption-key.md).

# Set a custom encryption key for Duaer

Set a custom encryption key for Duaer to securely encrypt credentials.
## Set the key with an environment variable

Duaer creates a random encryption key automatically on the first launch and saves it in the instance data directory. If the key is not yet in the settings file, set an environment variable so Duaer uses your custom key instead of generating a new one.

In queue mode, you must specify the encryption key environment variable for all workers.

```
export DUAER_ENCRYPTION_KEY=<SOME RANDOM STRING>
```

Refer to [environment variables](/hosting/configuration/environment-variables.md) for more information on this variable.
## Questions

### How do you set a custom encryption key for Duaer?

Export DUAER_ENCRYPTION_KEY=<SOME RANDOM STRING>, or put it in .env / container injection and restart. Use a long random string. Each instance gets its own value; do not share production with development. In queue mode every worker needs the same key.

