Etcd.Microsoft.Extensions.Configuration
3.3.0
dotnet add package Etcd.Microsoft.Extensions.Configuration --version 3.3.0
NuGet\Install-Package Etcd.Microsoft.Extensions.Configuration -Version 3.3.0
<PackageReference Include="Etcd.Microsoft.Extensions.Configuration" Version="3.3.0" />
<PackageVersion Include="Etcd.Microsoft.Extensions.Configuration" Version="3.3.0" />
<PackageReference Include="Etcd.Microsoft.Extensions.Configuration" />
paket add Etcd.Microsoft.Extensions.Configuration --version 3.3.0
#r "nuget: Etcd.Microsoft.Extensions.Configuration, 3.3.0"
#:package Etcd.Microsoft.Extensions.Configuration@3.3.0
#addin nuget:?package=Etcd.Microsoft.Extensions.Configuration&version=3.3.0
#tool nuget:?package=Etcd.Microsoft.Extensions.Configuration&version=3.3.0
Etcd.Microsoft.Extensions.Configuration
Etcd.Microsoft.Extensions.Configuration is an etcd-backed configuration provider for Microsoft.Extensions.Configuration.
It lets you load configuration values from etcd into the standard .NET configuration pipeline, including support for key prefixes, watch-based refresh, and both direct and configuration-based settings.
Note: Starting with v2, Windows requires Windows 10 / Windows Server 2016 or later because the internal gRPC client uses HTTP/2.
Contents
Installation
Install the NuGet package:
dotnet add package Etcd.Microsoft.Extensions.Configuration
This package targets .NET 8, .NET 9, and .NET 10.
Setup
The library exposes an AddEtcd(...) extension method on ConfigurationBuilder.
At minimum, you need:
Credentialswith an etcd username and passwordEtcdSettingswith the etcd connection string
Basic HTTP example
using Etcd.Microsoft.Extensions.Configuration;
using Etcd.Microsoft.Extensions.Configuration.Auth;
using Etcd.Microsoft.Extensions.Configuration.Settings;
using Microsoft.Extensions.Configuration;
var config = new ConfigurationBuilder()
.AddEtcd(
new Credentials("MyEtcdUserName", "passw"),
new EtcdSettings("http://serveraddress:2379"))
.Build();
var mySection = config.GetSection("MySection");
var myKeyValue = mySection["MyKeyName"];
Using environment variables
You can also create credentials from environment variables:
var credentials = Credentials.FromEnvironmentVariables();
var config = new ConfigurationBuilder()
.AddEtcd(credentials, new EtcdSettings("http://localhost:2379"))
.Build();
The default environment variable names are:
ETCD_CLIENT_USER_NAMEETCD_CLIENT_PASSWORD
Usage
Prefix-based configuration
You can load only a subset of keys by applying a prefix:
var config = new ConfigurationBuilder()
.AddEtcd(
new Credentials("MyEtcdUserName", "passw"),
new EtcdSettings("http://localhost:2379"),
"MyApplication")
.Build();
This is useful when different services share the same etcd instance but use separate namespaces.
Multiple prefixes
var config = new ConfigurationBuilder()
.AddEtcd(
new Credentials("MyEtcdUserName", "passw"),
new EtcdSettings("http://localhost:2379"),
new[] { "App:Shared", "App:Specific" })
.Build();
Watching for changes
Watching is enabled by default. You can disable it or control unwatching behavior with the enableWatch and unwatchOnDispose parameters:
var config = new ConfigurationBuilder()
.AddEtcd(
new Credentials("MyEtcdUserName", "passw"),
new EtcdSettings("http://localhost:2379"),
keyPrefix: "MyApp",
enableWatch: true,
unwatchOnDispose: true)
.Build();
HTTPS configuration
When using HTTPS, a .crt CA certificate provided by the etcd administrator should be added to the system trust store.
Ubuntu
Copy the certificate to /usr/local/share/ca-certificates/ with a .crt extension, then update the system trust store:
sudo cp etcd-ca.crt /usr/local/share/ca-certificates/etcd-ca.crt
sudo update-ca-certificates
Arch Linux
Place the certificate in /etc/ca-certificates/trust-source/anchors/, then run:
sudo trust extract-compat
Windows
Install the certificate in Trusted Root Certification Authority.
HTTPS via appsettings.json
appsettings.json
{
"EtcdSettings": {
"ConnectionString": "https://serveraddress:2379"
}
}
using Etcd.Microsoft.Extensions.Configuration;
using Etcd.Microsoft.Extensions.Configuration.Auth;
using Etcd.Microsoft.Extensions.Configuration.Settings;
using Microsoft.Extensions.Configuration;
var jsonConfig = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
var config = new ConfigurationBuilder()
.AddEtcd(
new Credentials("MyEtcdUserName", "passw"),
new ConfigurationBasedEtcdSettings(jsonConfig))
.Build();
Settings can be composed from multiple configuration sources.
Testing locally
To run the integration tests locally, make sure an etcd instance is running on the default port without SSL:
http://localhost:2379
On Ubuntu, install the required tools:
sudo apt-get install etcd-server etcd-client
Create a root user and enable authentication:
etcdctl --endpoints=http://localhost:2379 user add root
etcdctl --endpoints=http://localhost:2379 auth enable
The repository includes Terraform files in tests/terraform/ to provision test keys for the integration setup.
cd tests/terraform
terraform init
terraform plan
terraform apply
After the etcd test data is ready, run the test projects from the src folder.
Contributing
Contributions are welcome. You can help by:
- improving documentation
- reporting bugs
- submitting fixes
- proposing features
- adding tests
- improving code quality
License
Licensed under the GNU Lesser General Public 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 is compatible. 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 is compatible. 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. |
-
net10.0
- dotnet-etcd (>= 10.0.0)
- Microsoft.Extensions.Configuration (>= 10.0.15)
-
net8.0
- dotnet-etcd (>= 10.0.0)
- Microsoft.Extensions.Configuration (>= 10.0.15)
-
net9.0
- dotnet-etcd (>= 10.0.0)
- Microsoft.Extensions.Configuration (>= 10.0.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.3.0 | 192 | 11/11/2026 |
| 3.2.2 | 1,280 | 10/13/2026 |
| 3.2.1 | 2,732 | 7/7/2026 |
| 3.2.0 | 180 | 7/6/2026 |
| 3.1.3 | 149 | 7/6/2026 |
| 3.1.2 | 1,879 | 3/13/2026 |
| 3.1.1 | 175 | 2/23/2026 |
| 3.1.0 | 6,087 | 10/22/2025 |
| 3.1.0-pre02 | 239 | 10/21/2025 |
| 3.1.0-pre01 | 243 | 10/21/2025 |
| 3.0.0 | 326 | 6/26/2025 |
| 3.0.0-pre01 | 258 | 6/23/2025 |
| 2.1.0 | 554 | 5/23/2024 |
| 2.0.1 | 608 | 12/2/2022 |
| 2.0.0 | 665 | 6/4/2022 |
| 1.1.0 | 284 | 10/31/2025 |
| 1.0.4 | 600 | 12/2/2022 |
| 1.0.3 | 1,604 | 6/1/2022 |
| 1.0.2 | 651 | 5/29/2022 |
| 1.0.1 | 719 | 11/15/2021 |