- Add Google Wire for compile-time dependency injection - Replace concrete service types with interfaces across handlers - Remove global state (DB, cache) in favor of constructor injection - Split monolithic files into focused modules: - config: separate files for each config domain - dto: converters split by domain (user, post, message, group) - cache: separate metrics.go and redis_cache.go - Introduce unified apperrors package with string-based error codes - Add transaction support with context-aware repository methods - Upgrade golang.org/x/crypto from 0.17.0 to 0.26.0
28 lines
722 B
Go
28 lines
722 B
Go
package config
|
|
|
|
// ServerConfig 服务器配置
|
|
type ServerConfig struct {
|
|
Host string `mapstructure:"host"`
|
|
Port int `mapstructure:"port"`
|
|
Mode string `mapstructure:"mode"`
|
|
}
|
|
|
|
// LogConfig 日志配置
|
|
type LogConfig struct {
|
|
Level string `mapstructure:"level"`
|
|
Encoding string `mapstructure:"encoding"`
|
|
OutputPaths []string `mapstructure:"output_paths"`
|
|
}
|
|
|
|
// RateLimitConfig 限流配置
|
|
type RateLimitConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
RequestsPerMinute int `mapstructure:"requests_per_minute"`
|
|
}
|
|
|
|
// UploadConfig 上传配置
|
|
type UploadConfig struct {
|
|
MaxFileSize int64 `mapstructure:"max_file_size"`
|
|
AllowedTypes []string `mapstructure:"allowed_types"`
|
|
}
|