> For the complete documentation index, see [llms.txt](https://contentbox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://contentbox.ortusbooks.com/v4.x/developing/developing-for-contentbox/back-end-development/overriding-contentbox-settings.md).

# Overriding ContentBox Settings

ContentBox allows you to override global site settings dynamically. This approach is great for container based deployments, but also for traditional overrides for testing or staging environments.

## Override ContentBox Settings via ColdBox.cfc

You can override any runtime setting for ContentBox via a configuration structure in your main `ColdBox.cfc` configuration file. This will allow developers to override any runtime setting for any site.

All you need to do is create the a `contentbox` structure in your `configure()` or any tier method, with the name of the site (`default` is the default site) and then any setting name-value pair.

```javascript
contentbox = {
    // Runtime Settings Override by site slug
    settings = {
        // Default site
        default = {
            "cb_search_adapter"      = "my.search.adapter",
            "cb_media_directoryRoot" = "/docker/mount"
        }
        }
}
```

### Override ContentBox Settings via Java Environment Variables

You can also override any runtime ContentBox setting by passing them via Docker/Java Runtime variables.

Since these are string keys we can now use our fancy structures like the settings above, so you must adhere to our recognition pattern:

```
contentbox_{site}_{setting}=value
```

Here is an example on adding a custom media root:

```
-Dcontentbox_default_cb_media_directoryRoot=./build/docker/contentbox/content
```

This will allow especially Docker environments to override settings as environments or even provide secrets. More is coming, so stay tuned to our updates.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://contentbox.ortusbooks.com/v4.x/developing/developing-for-contentbox/back-end-development/overriding-contentbox-settings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
