Files
tokens-reef/backend/internal/config/billing.go
User a4eb4d4c3a refactor(config): split config.go into modular files
Split the monolithic config.go (~120KB) into focused modules:
- auth.go: JWT, TOTP, Turnstile, RateLimit configs
- billing.go: Billing and Pricing configs
- database.go: Database and Redis configs
- gateway.go: Gateway and Upstream configs
- gateway_sub.go: Gateway sub-configurations
- ops_and_cache.go: Ops and Cache configs
- platforms.go: Platform-specific configs
- security.go: Security-related configs
- server.go: Server configuration
- config_defaults.go: Default values
- config_defaults_detail.go: Detailed defaults
- config_helpers.go: Helper functions
- config_validate.go: Validation logic
- config_validate_gateway.go: Gateway validation

This improves:
- Code maintainability and readability
- Faster compilation (smaller files)
- Easier navigation and debugging
- Better separation of concerns
2026-04-17 07:22:55 +08:00

24 lines
1.1 KiB
Go
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.
package config
// BillingConfig 计费配置
type BillingConfig struct {
CircuitBreaker CircuitBreakerConfig `mapstructure:"circuit_breaker"`
}
type CircuitBreakerConfig struct {
Enabled bool `mapstructure:"enabled"`
FailureThreshold int `mapstructure:"failure_threshold"`
ResetTimeoutSeconds int `mapstructure:"reset_timeout_seconds"`
HalfOpenRequests int `mapstructure:"half_open_requests"`
}
// PricingConfig 定价数据配置
type PricingConfig struct {
RemoteURL string `mapstructure:"remote_url"` // 远程 URL默认 LiteLLM 镜像)
HashURL string `mapstructure:"hash_url"` // 哈希校验文件 URL
DataDir string `mapstructure:"data_dir"` // 本地数据目录
FallbackFile string `mapstructure:"fallback_file"` // 回退文件路径
UpdateIntervalHours int `mapstructure:"update_interval_hours"` // 更新间隔(小时)
HashCheckIntervalMinutes int `mapstructure:"hash_check_interval_minutes"` // 哈希校验间隔(分钟)
}