docs(readme): 为所有客户端SDK添加英文版README及语言切换链接

This commit is contained in:
2026-08-01 21:06:23 +08:00
parent 89b2c4b478
commit 09e637584f
16 changed files with 865 additions and 0 deletions
+2
View File
@@ -1,5 +1,7 @@
# Kenaito Config Center Perl Client
[English](README_EN.md) | 中文
Perl 客户端 SDK,适用于 Perl 5.16+ 项目。
## 安装
+89
View File
@@ -0,0 +1,89 @@
# Kenaito Config Center Perl Client
Perl client SDK for the Kenaito Config Center, suitable for Perl 5.16+ projects.
## Installation
### Install from Local
```bash
cd kenaito-conf-perl-client
cpanm .
```
### Development Mode (Symlink)
Add the lib path in your demo project:
```perl
use lib '/path/to/kenaito-conf-perl-client/lib';
```
## Usage
```perl
use Kenaito::Conf::Config;
use Kenaito::Conf::Client;
my $cfg = Kenaito::Conf::Config->new(
base_url => 'http://localhost:8080',
app_name => 'my-app',
env => 'daily',
version => 'latest',
token => '',
sync_interval => 10,
cache_dir => '.',
);
my $client = Kenaito::Conf::Client->new(config => $cfg);
# Listen for config changes
$client->on_change(sub {
my ($changed) = @_;
for my $k (keys %$changed) {
print "config changed: $k = $changed->{$k}\n";
}
});
# Start client (fetch configs)
$client->start();
# Get config
my $value = $client->get('database.host');
my $all = $client->get_all();
# Manual sync
$client->sync_once();
# Stop
$client->stop();
```
## Configuration
| Parameter | Description | Default |
|-----------|-------------|---------|
| `base_url` | Config center URL | `http://localhost:8080` |
| `app_name` | Application name | (Required) |
| `env` | Environment | `dev` |
| `version` | Config version | `latest` |
| `token` | App token | Empty |
| `sync_interval` | Sync interval (seconds) | `60` |
| `ignore_global` | Whether to ignore global configs | `0` |
| `cache_dir` | Cache directory | `.` |
## Dependencies
- Perl 5.16+
- HTTP::Tiny
- JSON::PP
## Demo
```bash
cd kenaito-conf-perl-client-demo
KENAITO_BASE_URL=http://localhost:8080 \
KENAITO_APP_NAME=kenaito-springboot-demo \
KENAITO_ENV=daily \
perl app.pl
```