mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-09-05 15:56:39 +08:00
Add management API endpoints
This commit is contained in:
@@ -16,6 +16,7 @@ type Config struct {
|
||||
Balancer BalancerConfig `yaml:"balancer"`
|
||||
Metrics MetricsConfig `yaml:"metrics"`
|
||||
S3API S3APIConfig `yaml:"s3api"`
|
||||
API APIConfig `yaml:"api"`
|
||||
}
|
||||
|
||||
// ServerConfig 服务器配置
|
||||
@@ -75,6 +76,12 @@ type S3APIConfig struct {
|
||||
Host string `yaml:"host"` // 用于签名验证的Host(为空则使用请求的Host)
|
||||
}
|
||||
|
||||
// APIConfig 管理API配置
|
||||
type APIConfig struct {
|
||||
Enabled bool `yaml:"enabled"` // 是否启用管理API
|
||||
Token string `yaml:"token"` // API访问令牌
|
||||
}
|
||||
|
||||
// DatabaseConfig 数据库配置
|
||||
type DatabaseConfig struct {
|
||||
Type string `yaml:"type"` // 数据库类型: sqlite, mysql, postgres
|
||||
@@ -179,6 +186,11 @@ func (c *Config) SetDefaults() {
|
||||
if c.S3API.SecretKey == "" {
|
||||
c.S3API.SecretKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
||||
}
|
||||
|
||||
// 管理API默认值
|
||||
if c.API.Token == "" {
|
||||
c.API.Token = "your-secure-api-token-here"
|
||||
}
|
||||
}
|
||||
|
||||
// ParseMaxSize 解析最大容量字符串为字节
|
||||
|
||||
Reference in New Issue
Block a user