> For the complete documentation index, see [llms.txt](https://docs.shipwithdjango.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shipwithdjango.com/secret-management/order-of-retrieval.md).

# Order of retrieval

The secrets manager in ShipWithDjango follows a specific order when retrieving secrets:

1. **Cache**: First, it checks its cache to see if the secret has already been retrieved during the current session.
2. **Environment File**: Next, it looks in the `.env` file. If the secret is found there, it returns that value.
3. **External Provider**: If the secret is not found in the cache or the `.env` file, the manager will then query the configured external secret management service (Infisical, AWS, or Azure).

This layered approach allows you to easily override secrets for local development or testing by simply adding them to your `.env` file, while still benefiting from the security of an external provider in other environments.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.shipwithdjango.com/secret-management/order-of-retrieval.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.
