https://github.com/msx752/packzero.configuration
extension for the IConfiguration, appsettings.json mapping easily used class object rely on EnvironmentName
https://github.com/msx752/packzero.configuration
Last synced: over 1 year ago
JSON representation
extension for the IConfiguration, appsettings.json mapping easily used class object rely on EnvironmentName
- Host: GitHub
- URL: https://github.com/msx752/packzero.configuration
- Owner: msx752
- License: mit
- Created: 2023-02-26T20:33:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-04T23:53:06.000Z (over 3 years ago)
- Last Synced: 2025-03-19T13:11:18.658Z (over 1 year ago)
- Language: C#
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/PackZero.Configuration)
[](https://github.com/msx752/PackZero.Configuration/actions/workflows/codeql.yml)
[](https://github.com/msx752/PackZero.Configuration/blob/main/LICENSE.md)
# PackZero.Configuration
extension for the IConfiguration, appsettings.json mapping easily used class object rely on EnvironmentName (especially for the ConsoleApp)
# How to Use
``` c#
using PackZero.Configuration;
```
Example Configuration cs file
``` c#
public class GeneralConfig
{
public GeneralConfig()
{
DeveloperIds = new List();
}
public string DiscordAppToken { get; set; }
public List DeveloperIds { get; set; }
public ulong DeveloperServerId { get; set; }
}
```
displaying appsettings.json scope
``` json
{
"GeneralConfig": {
"DiscordAppId": 543218350067605504,
"DiscordAppToken": "tokenValue",
"DeveloperIds": [ 321249607107395585 ],
"DeveloperServerId": 543218350067605504
}
}
```
Service Collection defition
``` c#
services.AddAppZeroConfiguration(typeof(GeneralConfig));
```
# Features
- ConsoleApp Environment Configuration rely on appsettings.{environmentName}.json
usage
``` c#
var host = Host.CreateDefaultBuilder(args);
host.UseAppZeroConfiguration();
```