feat: replace iot adapter with mqtt command pipeline
This commit is contained in:
@@ -2,31 +2,32 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/conf"
|
||||
"net"
|
||||
)
|
||||
|
||||
// Spec 是 Worker 运行配置。
|
||||
var Spec SrvConfig
|
||||
|
||||
// SrvConfig 保持与 API 进程相同的 BSM 配置结构。
|
||||
type SrvConfig struct {
|
||||
conf.Base `yaml:",inline"`
|
||||
Databases *conf.DBConf `yaml:"Databases"`
|
||||
Rpc map[string]conf.RpcConf `yaml:"Rpc"`
|
||||
Apm *conf.ApmConf `yaml:"APM"`
|
||||
PaymentAPI PaymentAPIConfig `yaml:"PaymentAPI"`
|
||||
IoTAPI IoTAPIConfig `yaml:"IoTAPI"`
|
||||
}
|
||||
|
||||
// PaymentAPIConfig 保存 Worker 调用支付内部动作所需的最小配置。
|
||||
type PaymentAPIConfig struct {
|
||||
BaseURL string `yaml:"BaseURL"`
|
||||
Token string `yaml:"Token"`
|
||||
IntervalSeconds int `yaml:"IntervalSeconds"`
|
||||
}
|
||||
type IoTAPIConfig struct {
|
||||
PlatformBaseURL string `yaml:"PlatformBaseURL"`
|
||||
ClientBaseURL string `yaml:"ClientBaseURL"`
|
||||
Token string `yaml:"Token"`
|
||||
IntervalMilliseconds int `yaml:"IntervalMilliseconds"`
|
||||
}
|
||||
|
||||
// New 初始化 Worker 配置。
|
||||
func New(srvKey string) {
|
||||
conf.New(srvKey, &Spec)
|
||||
Spec.Port = conf.CheckPort(Spec.Port)
|
||||
@@ -36,5 +37,8 @@ func New(srvKey string) {
|
||||
if Spec.PaymentAPI.BaseURL == "" || Spec.PaymentAPI.Token == "" || Spec.PaymentAPI.IntervalSeconds <= 0 {
|
||||
panic("PaymentAPI configuration is required")
|
||||
}
|
||||
if Spec.IoTAPI.PlatformBaseURL == "" || Spec.IoTAPI.ClientBaseURL == "" || Spec.IoTAPI.Token == "" || Spec.IoTAPI.IntervalMilliseconds <= 0 {
|
||||
panic("IoTAPI configuration is required")
|
||||
}
|
||||
conf.PrintInfo(Spec.Addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user