Skip to content

Commit 9458b33

Browse files
committed
Config path override example
1 parent 33ef241 commit 9458b33

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ public sealed class Configuration
173173
/// </summary>
174174
public string Value { get; set; } = string.Empty; // overriden from config
175175
}
176+
177+
// instead of the default configuration path which is namespace.classname, you can override:
178+
[Configuration("myconfig")]
179+
public sealed class Configuration
180+
{
181+
/// <summary>
182+
/// Example value
183+
/// </summary>
184+
public string Value { get; set; } = string.Empty; // overriden from config
185+
}
186+
187+
// appsettings.json for override:
188+
{
189+
"myconfig": { Value: "test" }
190+
}
176191
```
177192

178193
You can inject your `Configuration` class into any constructor as normal.

0 commit comments

Comments
 (0)