EnvoyConfig 0.1.0-alpha.1
See the version list below for details.
dotnet add package EnvoyConfig --version 0.1.0-alpha.1
NuGet\Install-Package EnvoyConfig -Version 0.1.0-alpha.1
<PackageReference Include="EnvoyConfig" Version="0.1.0-alpha.1" />
<PackageVersion Include="EnvoyConfig" Version="0.1.0-alpha.1" />
<PackageReference Include="EnvoyConfig" />
paket add EnvoyConfig --version 0.1.0-alpha.1
#r "nuget: EnvoyConfig, 0.1.0-alpha.1"
#:package EnvoyConfig@0.1.0-alpha.1
#addin nuget:?package=EnvoyConfig&version=0.1.0-alpha.1&prerelease
#tool nuget:?package=EnvoyConfig&version=0.1.0-alpha.1&prerelease
<p align="center"> <img src="assets/logo.svg" alt="EnvoyConfig Logo" width="64"/> </p>
🚀 EnvoyConfig
EnvoyConfig is a modern C# library for .NET 8+ that loads strongly-typed configuration objects from environment variables at runtime using reflection. It supports advanced attribute-based mapping, type safety, nested objects, lists, dictionaries, and flexible prefixing—all with minimal boilerplate.
✨ Features
- Attribute-based configuration:
[Env]
attribute for mapping properties to env vars - Supports primitives, enums, nullable types, lists, arrays, dictionaries, and nested objects
- Multiple initialization modes: direct key, comma-separated/numbered lists, dictionary/map, nested prefix
- Global/static prefix support
- Logging integration with adapters (Microsoft, Serilog, NLog)
- Thread-safe, high performance (caching)
- Zero external dependencies in core
📦 Installation
dotnet add package EnvoyConfig
Optional:
dotnet add package EnvoyConfig.Adapters.Microsoft # For Microsoft.Extensions.Logging
🚀 Quick Start
public class MyConfig {
[Env(Key = "MYAPP_PORT", Default = "8080")]
public int Port { get; set; }
[Env(Key = "MYAPP_FEATURES", IsList = true)]
public List<string> Features { get; set; } = new();
}
EnvConfig.GlobalPrefix = "MYAPP_";
var config = EnvConfig.Load<MyConfig>();
🔧 Advanced Usage & Features
- Prefix Handling: Set
EnvConfig.GlobalPrefix
to prepend to all lookups. - Attribute Modes:
[Env(Key = "FOO")]
(direct key)[Env(Key = "BAR", IsList = true)]
(comma-separated list)[Env(ListPrefix = "ITEM_")]
(numbered list: ITEM_1, ITEM_2, ...)[Env(MapPrefix = "MAP_")]
(dictionary: MAP_key1=val1, MAP_key2=val2)[Env(NestedPrefix = "DB_")]
(nested object)
- Supported Types: string, int, bool, double, enums, nullable types, List<T>, T[], Dictionary<TKey,TValue>
- Logging: Pass a custom logger (
IEnvLogSink
) or use an adapter for your framework.
📚 Documentation
See here for Documentation.
🛠️ Troubleshooting / FAQ
- Type conversion errors: check env var values and types
- Missing env vars: use
Default
or handle nulls - Prefix confusion: ensure GlobalPrefix and attribute keys are set as intended
- Logging: implement or use provided adapters for structured logs
🤝 Contributing
Contributions are welcome! Please open issues or PRs for bugs, features, or questions.
📜 License
GPL-3.0-or-later. See LICENSE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on EnvoyConfig:
Package | Downloads |
---|---|
EnvoyConfig.Adapters.NLog
Package Description |
|
EnvoyConfig.Adapters.Serilog
Package Description |
|
EnvoyConfig.Adapters.Microsoft
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 558 | 6/25/2025 |
0.1.0-beta.108 | 128 | 6/24/2025 |
0.1.0-beta.96 | 132 | 6/22/2025 |
0.1.0-beta.81 | 191 | 6/15/2025 |
0.1.0-alpha.1 | 64 | 5/3/2025 |