doc: 增加代码注释
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Package config 负责从环境变量加载应用配置。
|
||||
package config
|
||||
|
||||
import (
|
||||
@@ -5,12 +6,14 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Config 应用全局配置,优先读取环境变量,未设置时使用默认值。
|
||||
type Config struct {
|
||||
Port int
|
||||
Mode string
|
||||
MaxFileSize int64 // bytes
|
||||
Port int // HTTP 监听端口,默认 8080,环境变量 GEN2D_PORT
|
||||
Mode string // Gin 运行模式 (debug/release),环境变量 GEN2D_MODE
|
||||
MaxFileSize int64 // 上传文件大小上限(字节),默认 10MB
|
||||
}
|
||||
|
||||
// Load 从环境变量加载配置并返回。
|
||||
func Load() *Config {
|
||||
cfg := &Config{
|
||||
Port: 8080,
|
||||
|
||||
Reference in New Issue
Block a user