mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 17:12:25 +08:00
refactor: standardize code comments
This commit is contained in:
@@ -6,26 +6,26 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 全局配置实例
|
||||
// Global configuration instance
|
||||
var global *Config
|
||||
|
||||
// Config 全局配置(从 .env 加载)
|
||||
// 只包含真正的全局配置,交易相关配置在 trader/策略 级别
|
||||
// Config is the global configuration (loaded from .env)
|
||||
// Only contains truly global config, trading related config is at trader/strategy level
|
||||
type Config struct {
|
||||
// 服务配置
|
||||
// Service configuration
|
||||
APIServerPort int
|
||||
JWTSecret string
|
||||
RegistrationEnabled bool
|
||||
}
|
||||
|
||||
// Init 初始化全局配置(从 .env 加载)
|
||||
// Init initializes global configuration (from .env)
|
||||
func Init() {
|
||||
cfg := &Config{
|
||||
APIServerPort: 8080,
|
||||
RegistrationEnabled: true,
|
||||
}
|
||||
|
||||
// 从环境变量加载
|
||||
// Load from environment variables
|
||||
if v := os.Getenv("JWT_SECRET"); v != "" {
|
||||
cfg.JWTSecret = strings.TrimSpace(v)
|
||||
}
|
||||
@@ -46,7 +46,7 @@ func Init() {
|
||||
global = cfg
|
||||
}
|
||||
|
||||
// Get 获取全局配置
|
||||
// Get returns the global configuration
|
||||
func Get() *Config {
|
||||
if global == nil {
|
||||
Init()
|
||||
|
||||
Reference in New Issue
Block a user