定义ReleaseFeedWeightTask并注入依赖

This commit is contained in:
2025-09-25 09:44:32 +08:00
parent e1a1b29a0f
commit 0d6d1db290
9 changed files with 95 additions and 49 deletions

View File

@@ -30,6 +30,9 @@ type Config struct {
// Heartbeat 心跳配置
Heartbeat HeartbeatConfig `yaml:"heartbeat"`
// ChirpStack ChirpStack API 配置
ChirpStack ChirpStackConfig `yaml:"chirp_stack"`
// TaskConfig 任务调度配置
Task TaskConfig `yaml:"task"`
}
@@ -112,6 +115,14 @@ type HeartbeatConfig struct {
Concurrency int `yaml:"concurrency"`
}
// ChirpStackConfig 代表 ChirpStack API 配置
type ChirpStackConfig struct {
APIHost string `yaml:"api_host"`
APIToken string `yaml:"api_token"`
FPort int `yaml:"fport"`
APITimeout int `yaml:"api_timeout"`
}
// TaskConfig 代表任务调度配置
type TaskConfig struct {
Interval int `yaml:"interval"`
@@ -139,3 +150,8 @@ func (c *Config) Load(path string) error {
return nil
}
// GenerateAPIKey 用于补齐API Key作为请求头时缺失的部分
func (c ChirpStackConfig) GenerateAPIKey() string {
return "Bearer " + c.APIToken
}