Files
kenaito-conf/kenaito-conf-dotnet-client
odboy af3cf2f6e6 feat(token): 将token迁移至请求体并兼容旧版客户端
- C++客户端在请求payload中添加token字段
- .NET客户端在请求payload中添加token字段
- Rust客户端在请求payload中添加token字段
- SpringBoot2客户端移除buildTokenParameter调用,改为将token放入请求体
- SpringBoot3客户端移除buildTokenParameter调用,改为将token放入请求体
- SpringBoot2/3客户端新增getToken方法供内部调用
- 服务端增加兼容逻辑,优先从请求体获取token,为空时回退至URL query参数
2026-09-13 21:07:56 +08:00
..

Kenaito Config Center .NET Client

.NET client SDK for the Kenaito Config Center.

Installation

Local Build

cd kenaito-conf-dotnet-client
dotnet build

As Local Dependency

Reference in the demo project's csproj:

<ItemGroup>
  <ProjectReference Include="../kenaito-conf-dotnet-client/KenaitoConfClient.csproj" />
</ItemGroup>

Quick Start

using Kenaito.Conf.Client;

var config = new Config
{
    BaseUrl = "http://localhost:8080",
    AppName = "kenaito-dotnet-demo",
    Env = "daily",
    SyncInterval = 10
};

var client = new Client(config);

client.OnChange(changed =>
{
    Console.WriteLine("Config changed:");
    foreach (var kv in changed)
    {
        Console.WriteLine($"  {kv.Key} = {kv.Value}");
    }
});

await client.StartAsync();

var dbHost = client.Get("database.host");
Console.WriteLine($"database.host = {dbHost}");

Console.ReadLine();
client.Stop();

Configuration

Parameter Description Default Required
BaseUrl Config center URL - Yes
AppName Application name - Yes
Env Environment dev No
Version Config version latest No
Token Auth token null No
SyncInterval Sync interval (seconds) 10 No
CacheDir Cache directory . No
IgnoreGlobal Whether to ignore global configs false No

Features

  • Fetch all configs on startup
  • Periodic incremental config sync
  • Local file cache, load from cache when service is unavailable
  • Config change callback notification