Files
any-hub/specs/003-hub-auth-fields/contracts/config-schema.md
2025-11-14 12:11:44 +08:00

32 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Config Schema Contract
```toml
# Global section
ListenPort = 5000
LogLevel = "info"
StoragePath = "./storage"
CacheTTL = 86400
# ... existing global keys ...
[[Hub]]
Name = "docker"
Domain = "docker.hub.local"
Upstream = "https://registry-1.docker.io"
Proxy = ""
Username = "" # optional
Password = "" # optional
Type = "docker" # required, must be docker|npm|go
CacheTTL = 43200 # optional override
```
```
| Field | Required | Type | Notes |
|----------------------|----------|---------|-------|
| `ListenPort` | Yes | int | 单端口监听,范围 1-65535 |
| `Username`/`Password`| No | string | 缺省表示匿名;若任一非空则视为 credentialed日志仅显示掩码 |
| `Type` | Yes | enum | 当前支持 `docker`/`npm`/`go`,输入其他值时报错 |
**Validation Contract**
1. `any-hub --check-config` 必须在缺失 `Type` 或非法 `ListenPort` 时返回非 0。
2. CLI 日志需输出 `hub_type` 与 `auth_mode` 字段,以便运维确认配置是否生效。