Skip to content

Commit 5cc8301

Browse files
Updating readme
1 parent 1406f11 commit 5cc8301

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

DynamicSettings/DynamicSettings.nuspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
<title>$title$</title>
77
<authors>$author$</authors>
88
<owners>$author$</owners>
9-
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
9+
<licenseUrl>https://github.com/lcom/DynamicSettings/blob/master/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/lcom/DynamicSettings</projectUrl>
1011
<description>$description$</description>
11-
<copyright>Copyright 2015</copyright>
12+
<copyright>Copyright 2015 Learning.com. All rights reserved.</copyright>
13+
<tags>settings configuration</tags>
1214
<dependencies>
1315
<dependency id="Newtonsoft.Json" version="7.0.1" />
1416
<dependency id="StackExchange.Redis" version="1.0.488" />

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Dynamic Settings
2+
================
3+
Dynamic Settings is a .NET library that allows you to load application settings from a variety of sources including environment variables, ConfigurationManager, text files, YAML files, and Redis.
4+
5+
Install
6+
=======
7+
Binaries are available on Nuget at https://www.nuget.org/DynamicSettings
8+
9+
To install, run the following command in the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console)
10+
11+
PM> Install-Package DynamicSettings
12+
13+
Usage
14+
=====
15+
You can set up your DI container to cascade through the different types of settings as follows. This example uses Autofac, but others will be similar.
16+
17+
var builder = new ContainerBuilder();
18+
builder.Register(c => new AppSettings(new EnvironmentVariableSettings("MYAPP_"), new FileSettings(".", "*.key"), new YamlSettings("Config.yaml"), new ConfigurationManagerSettings())).SingleInstance();
19+
20+
When a setting is accessed through the AppSettings class, this will first look in the EnvironmentVariableSettings, if the setting isn't there, it will then look in FileSettings, then YamlSettings, etc.
21+
22+
Inject an instance of AppSettings and access your configuration settings through it.
23+
24+
public class MyClass
25+
{
26+
private dynamic _appSettings
27+
28+
public MyClass(AppSettings settings)
29+
{
30+
_appSettings = settings;
31+
}
32+
33+
public GetMySetting()
34+
{
35+
var setting = _appSettings.MySetting
36+
37+
return setting;
38+
}
39+
}
40+

0 commit comments

Comments
 (0)