# Combine sources

**Requires**: [main sources module](/configuration/modules/sources.md).

Multiple configuration sources can be combined into a single composite source whose data is produced by [merging](/configuration/concepts-and-basics/settings-nodes-merging.md) the [settings trees](/configuration/concepts-and-basics/settings-nodes.md) provided by original sources.&#x20;

```
var source1 = new JsonStringSource(...);
var source2 = new YamlStringSource(...);
var source3 = new XmlStringSource(...);

var combined = source1.CombineWith(source2, source3);

// combined == Merge(source1, source2, source3)

// combined.Data == Merge(Merge(source1.data, source2.data), source3.data)
```

Order of the sources is important: settings from sources that come later in the list have greater priority, hence the rightmost source should be the most specific/significant. In other words, merging is performed in a left-to-right fashion.

Updates are pushed to subscribers each time one of the component sources generates new settings.

### Related pages

{% content-ref url="/pages/-M6UQ\_P-kBl5fYeP5InQ" %}
[Settings nodes merging](/configuration/concepts-and-basics/settings-nodes-merging.md)
{% endcontent-ref %}

{% content-ref url="/pages/-M6UQMklC2EtQ\_nAUDjI" %}
[Configuration sources](/configuration/concepts-and-basics/configuration-sources.md)
{% endcontent-ref %}


---

# 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://vostok.gitbook.io/configuration/basic-scenarios/combine-sources.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.
