Quickstart

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

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"
}
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:

Last updated