2026-08-27 10:09:54 +08:00
|
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
2026-08-27 19:50:57 +08:00
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
2026-08-27 10:09:54 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
2026-08-27 19:50:57 +08:00
|
|
|
|
// AuthConfig JWT 登录鉴权配置
|
|
|
|
|
|
// 注意:go-zero conf 仅识别 json 标签(yaml/toml 文件统一转为 JSON 后按此映射)
|
|
|
|
|
|
type AuthConfig struct {
|
|
|
|
|
|
AccessSecret string `json:",default=bj-power-ws-secret-2026"`
|
|
|
|
|
|
AccessExpire int64 `json:",default=1800"` // 有效期(秒)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MesConfig MES 服务地址(内部 API)
|
|
|
|
|
|
type MesConfig struct {
|
|
|
|
|
|
BaseURL string `json:",default=http://127.0.0.1:8888"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// InternalConfig 项目间内部 API 写死 token(X-API-TOKEN)
|
|
|
|
|
|
type InternalConfig struct {
|
|
|
|
|
|
Token string `json:",default=bj-power-internal-2026"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SimConfig 内置模拟拧紧枪数据源开关
|
|
|
|
|
|
type SimConfig struct {
|
|
|
|
|
|
Enable bool `json:",default=true"`
|
2026-08-27 10:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-27 19:50:57 +08:00
|
|
|
|
// SqliteConfig 本地 SQLite 缓存库
|
|
|
|
|
|
type SqliteConfig struct {
|
|
|
|
|
|
Path string `json:",default=workstation.db"`
|
2026-08-27 10:09:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-27 19:50:57 +08:00
|
|
|
|
type Config struct {
|
|
|
|
|
|
rest.RestConf
|
|
|
|
|
|
Auth AuthConfig `json:",optional"`
|
|
|
|
|
|
Mes MesConfig `json:",optional"`
|
|
|
|
|
|
Internal InternalConfig `json:",optional"`
|
|
|
|
|
|
Sim SimConfig `json:",optional"`
|
|
|
|
|
|
Sqlite SqliteConfig `json:",optional"`
|
2026-08-27 10:09:54 +08:00
|
|
|
|
}
|