Vostok.Configuration
HomeQuickstartConcepts and basicsBasic scenarios
  • Home
  • Quickstart
  • Concepts and basics
    • Settings nodes
      • Value nodes
      • Array nodes
      • Object nodes
    • Settings nodes merging
    • Settings nodes scoping
    • Binding nodes to models
    • Configuration sources
    • Configuration provider
    • Caching and performance
    • Error handling
  • Modules
    • Abstractions
    • Configuration
    • Sources
    • Sources.CC
    • Sources.Json
    • Sources.Yaml
    • Sources.Xml
    • Sources.Vault
    • Logging
    • Microsoft
  • Sources
    • Constant sources
    • Object source
    • XML sources
    • YAML sources
    • JSON sources
    • Vault source
    • ClusterConfig source
    • Command line source
    • Environment variables source
  • Binders
    • Primitives
    • Collections
    • Classes and structs
    • Constructor injection
  • Basic scenarios
    • Assign sources to types
    • Obtain settings from provider
    • Observe settings via provider
    • Print settings
    • Log settings updates
    • Log errors
    • Combine sources
    • Scope sources
    • Make settings secret
    • Make settings required
  • Advanced scenarios
    • Use name aliases
    • Use dynamic interfaces
    • Use shared provider instance
    • Use value substitutions
    • Nest sources
    • Freeze sources
    • Transform sources
    • Create custom sources
    • Apply custom validators
    • Apply custom binders
    • Apply source data to existing object
    • Print contents of a source
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Concepts and basics

Configuration sources

PreviousBinding nodes to modelsNextConfiguration provider

Last updated 4 years ago

Was this helpful?

Configuration sources fetch data from storage (local files or remote APIs) and convert it to , abstracting away actual data formats such as JSON or YAML.

They are not meant to be consumed directly and should be used in conjunction with a (see and scenarios).

Sources are also responsible for data change detection. They expose a with subscription support:

IObservable<(ISettingsNode settings, Exception error)> Observe();

On each update, triggered either periodically or by an internal event, the source emits a pair: (settings, null) on success or (null, error) on failure. It's not required to deduplicate settings or errors at this level, although it's never wrong to do so.

Sources must never block indefinitely while waiting for data and should rather publish null settings after a short initial timeout.

Sources must be thread-safe and should be designed to support multiple concurrent observers. It is also expected that every new observer would immediately receive a notification with current state upon subscription.

Here are some of the often used source implementations:

It's also possible to .

Related pages

settings nodes
configuration provider
assign sources to types
obtain settings from provider
reactive interface
JSON source
ClusterConfig source
In-memory object source
implement a custom source
Sources
Combine sources
Scope sources
Nest sources
Transform sources
Create custom sources
Assign sources to types
Obtain settings from provider