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

Quickstart

PreviousHomeNextConcepts and basics

Last updated 4 years ago

Was this helpful?

Here's the simplest way to experience Vostok.Configuration for the first time:

  • Install , and modules:

Install-Package Vostok.Configuration
Install-Package Vostok.Configuration.Abstractions
Install-Package Vostok.Configuration.Sources.Json
  • Define a settings model class:

class MySettings 
{
    public string Key1 { get; }
    public string Key2 { get; }
}
  • Create a JSON file with settings:

{
    "key1": "value1",
    "key2": "value2"
}
  • Obtain a model instance with a from a file and print it:

var provider = new ConfigurationProvider();

provider.SetupSourceFor<MySettings>(new JsonFileSource("settings.json"));

var settings = provider.Get<MySettings>();

Console.Out.WriteLine(ConfigurationPrinter.Print(settings));

Great job! Here are some possible next steps:

Learn the most basic concepts: , , , ;

Explore available and ;

Go over the .

main
abstractions
sources.json
configuration provider
source
settings nodes
sources
binding
provider
modules
source implementations
basic scenarios section