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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Etcd.Microsoft.Extensions.Configuration" Version="3.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Etcd.Microsoft.Extensions.Configuration" Version="3.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Etcd.Microsoft.Extensions.Configuration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Etcd.Microsoft.Extensions.Configuration --version 3.3.0
                    
#r "nuget: Etcd.Microsoft.Extensions.Configuration, 3.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Etcd.Microsoft.Extensions.Configuration@3.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Etcd.Microsoft.Extensions.Configuration&version=3.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Etcd.Microsoft.Extensions.Configuration&version=3.3.0
                    
Install as a Cake Tool

Etcd.Microsoft.Extensions.Configuration

NuGet Version NuGet Download Build Package Libraries.io dependency status for latest release CodeFactor Grade Platform

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:

  • Credentials with an etcd username and password
  • EtcdSettings with 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_NAME
  • ETCD_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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 191 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
Loading failed