> For the complete documentation index, see [llms.txt](https://vostok.gitbook.io/configuration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vostok.gitbook.io/configuration/basic-scenarios/combine-sources.md).

# 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 %}
