54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package config
|
||
|
||
import (
|
||
"github.com/zeromicro/go-zero/rest"
|
||
)
|
||
|
||
// AuthConfig JWT 登录鉴权配置
|
||
// go-zero conf 仅识别 json 标签(yaml/toml 统一转为 JSON 后按此映射)
|
||
type AuthConfig struct {
|
||
AccessSecret string `json:",default=Hardman_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=Hardman_2026"`
|
||
}
|
||
|
||
// SimConfig 内置模拟拧紧枪数据源开关
|
||
type SimConfig struct {
|
||
Enable bool `json:",default=true"`
|
||
}
|
||
|
||
// SqliteConfig 本地 SQLite 缓存库
|
||
type SqliteConfig struct {
|
||
Path string `json:",default=workstation.db"`
|
||
}
|
||
|
||
// StationConfig 工位配置:可从配置文件指定固定工位,并定义该工位需拧紧的螺丝颗数
|
||
type StationConfig struct {
|
||
Code string `json:",optional"` // 固定工位号(如 DOCK01);留空则由终端自选
|
||
ScrewCount int `json:",default=10"` // 本工位需拧紧的螺丝颗数(进度 9/10 用)
|
||
}
|
||
|
||
// PdfCacheConfig 工艺文件 PDF 本地预缓存目录
|
||
type PdfCacheConfig struct {
|
||
Dir string `json:",default=pdf_cache"` // 本地缓存目录;留空关闭缓存
|
||
}
|
||
|
||
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"`
|
||
Station StationConfig `json:",optional"`
|
||
PdfCache PdfCacheConfig `json:",optional"`
|
||
} |