初始化2
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"bj_power_mes/common/logx"
|
||||
"bj_power_mes/internal/db"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
// Config 全局配置
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
Host string `json:",default=0.0.0.0"`
|
||||
Port int `json:",default=8080"`
|
||||
Database db.DatabaseConf
|
||||
Redis RedisConfWrapper
|
||||
Auth AuthConf
|
||||
Internal InternalConf
|
||||
Logger logx.LogConf
|
||||
Wms WmsConf
|
||||
Plc PlcConf
|
||||
}
|
||||
|
||||
type RedisConfWrapper struct {
|
||||
redis.RedisConf
|
||||
}
|
||||
|
||||
// AuthConf 鉴权配置:JWT Secret / 有效期
|
||||
type AuthConf struct {
|
||||
AccessSecret string `json:",default=Hardman_2026"`
|
||||
AccessExpire int64 `json:",default=1800"` // access token 短有效(秒)
|
||||
RefreshExpire int64 `json:",default=86400"` // refresh token(秒)
|
||||
}
|
||||
|
||||
// InternalConf 内部服务间鉴权
|
||||
type InternalConf struct {
|
||||
Token string `json:",default=Hardman_2026"`
|
||||
}
|
||||
|
||||
// WmsConf WMS 内部服务地址
|
||||
type WmsConf struct {
|
||||
BaseURL string `json:",default="`
|
||||
Token string `json:",default=Hardman_2026"`
|
||||
}
|
||||
|
||||
// PlcConf PLC 对接配置(mock 时不用)
|
||||
type PlcConf struct {
|
||||
Enable bool `json:",default=false"`
|
||||
Host string `json:",default=127.0.0.1"`
|
||||
Port int `json:",default=102"`
|
||||
}
|
||||
Reference in New Issue
Block a user