yiwwan.Microsoft.Extensions.Configuration.Etcd
0.0.1
dotnet add package yiwwan.Microsoft.Extensions.Configuration.Etcd --version 0.0.1
NuGet\Install-Package yiwwan.Microsoft.Extensions.Configuration.Etcd -Version 0.0.1
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="yiwwan.Microsoft.Extensions.Configuration.Etcd" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add yiwwan.Microsoft.Extensions.Configuration.Etcd --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: yiwwan.Microsoft.Extensions.Configuration.Etcd, 0.0.1"
#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.
// Install yiwwan.Microsoft.Extensions.Configuration.Etcd as a Cake Addin #addin nuget:?package=yiwwan.Microsoft.Extensions.Configuration.Etcd&version=0.0.1 // Install yiwwan.Microsoft.Extensions.Configuration.Etcd as a Cake Tool #tool nuget:?package=yiwwan.Microsoft.Extensions.Configuration.Etcd&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Microsoft.Extensions.Configuration.Etcd
Etcd as a configuration source for Asp.Net Core applications.
Usage
// Register your etcd endpoint to the process of building your host in Program.cs
...
// AspNet Core 3.0
.ConfigureAppConfiguration(config =>
{
config.AddEtcd("127.0.0.1", 2379, options=>
{
//options.Prefix = "ETCD_"; // Prefix for matching configuration keys for etcd. Default is "ETCD_".
//options.RemovePrefix = true; // Should the lib remove the prefix from the key when used for querying. Default is true.
//options.UserName = ...; // Auth options
//options.Password = ...; // Auth options
});
})
...
Note
Values fetched from cluster will be cached to local memory. To refresh them, provide a IChangeToken
producer to the options to refresh the cache. Sample implementation:
// EtcdConfigurationRefresher.cs
public class EtcdConfigurationRefresher : IChangeToken
{
private Registration? registration;
public bool ActiveChangeCallbacks => false;
public bool HasChanged => false;
public IDisposable RegisterChangeCallback(Action<object> callback, object state)
{
registration = new Registration(this, callback, state);
return registration;
}
public void Refresh()
{
registration?.Refresh();
}
public void Reset()
{
registration = null;
}
public static EtcdConfigurationRefresher Instance { get; } = new EtcdConfigurationRefresher();
private class Registration : IDisposable
{
private readonly EtcdConfigurationRefresher refresher;
private readonly Action<object> callback;
private readonly object state;
public Registration(EtcdConfigurationRefresher refresher, Action<object> callback, object state)
{
this.refresher = refresher;
this.callback = callback;
this.state = state;
}
public void Dispose()
{
refresher.Reset();
}
public void Refresh()
{
callback?.Invoke(state);
}
}
}
// Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(config =>
{
config.AddEtcd("127.0.0.1", 2379, options=>
{
options.ChangeTokenProvider = () => EtcdConfigurationRefresher.Instance;
});
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
// ValuesController.cs
[HttpGet("reset")]
public void Reset()
{
EtcdConfigurationRefresher.Instance.Refresh();
}
Calling EtcdConfigurationRefresher.Instance.Refresh()
will clear all local cache.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- dotnet-etcd (>= 2.3.1)
- Microsoft.Extensions.Configuration (>= 2.2.0)
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 |
---|---|---|
0.0.1 | 579 | 8/25/2019 |