Create custom sources
Requires: sources module.
Sources module offers a couple of base classes to assist in implementing custom configuration sources.
For in-memory sources or sources that can update an in-memory one from a remote API.
class MySource : ManualFeedSource<string>
{
public MySource()
: base(Parse) { }
private static ISettingsNode Parse(string input) { ... }
}
var source = new MySource();
source.Push("input1");
source.Push("input2");
// Push method can be used by an internal periodical/event-based update routine.
For sources based on local files. Includes automatic reload on file updates.
class MyFileSource : FileSource
{
public MyFileSource(string filePath)
: base(new FileSourceSettings(filePath), Parse) { }
private static ISettingsNode Parse(string input) { ... }
}
Related pages
Configuration sourcesConstant sourcesCombine sourcesScope sourcesNest sourcesFreeze sourcesLast updated
Was this helpful?