extension for the IConfiguration, appsettings.json mapping easily used class object rely on EnvironmentName (especially for the ConsoleApp)
using PackZero.Configuration;Example Configuration cs file
public class GeneralConfig
{
public GeneralConfig()
{
DeveloperIds = new List<ulong>();
}
public string DiscordAppToken { get; set; }
public List<ulong> DeveloperIds { get; set; }
public ulong DeveloperServerId { get; set; }
}displaying appsettings.json scope
{
"GeneralConfig": {
"DiscordAppId": 543218350067605504,
"DiscordAppToken": "tokenValue",
"DeveloperIds": [ 321249607107395585 ],
"DeveloperServerId": 543218350067605504
}
}
Service Collection defition
services.AddAppZeroConfiguration(typeof(GeneralConfig));- ConsoleApp Environment Configuration rely on appsettings.{environmentName}.json usage
var host = Host.CreateDefaultBuilder(args);
host.UseAppZeroConfiguration();