kanban dashboard refactor
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"tm/pkg/authorization"
|
||||
"tm/pkg/config"
|
||||
"tm/pkg/filestore"
|
||||
"tm/pkg/gorules"
|
||||
"tm/pkg/hcaptcha"
|
||||
"tm/pkg/logger"
|
||||
"tm/pkg/mongo"
|
||||
@@ -359,3 +360,36 @@ func InitAISummarizerStorage(conf AISummarizerConfig, log logger.Logger) *ai_sum
|
||||
|
||||
return storage
|
||||
}
|
||||
|
||||
// InitGoRulesClient initializes the GoRules SDK client.
|
||||
func InitGoRulesClient(conf GoRulesConfig, log logger.Logger) gorules.Client {
|
||||
if conf.BaseURL == "" || conf.Token == "" || conf.RuleID == "" {
|
||||
log.Warn("GoRules client not configured, falling back to static Kanban statuses", map[string]interface{}{})
|
||||
return nil
|
||||
}
|
||||
|
||||
timeout := conf.Timeout
|
||||
if timeout <= 0 {
|
||||
timeout = 10 * time.Second
|
||||
}
|
||||
|
||||
client, err := gorules.New(gorules.Config{
|
||||
BaseURL: conf.BaseURL,
|
||||
Token: conf.Token,
|
||||
Timeout: timeout,
|
||||
}, log)
|
||||
if err != nil {
|
||||
log.Error("Failed to initialize GoRules client", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Info("GoRules client initialized successfully", map[string]interface{}{
|
||||
"base_url": conf.BaseURL,
|
||||
"timeout": timeout,
|
||||
"rule_id": conf.RuleID,
|
||||
})
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ type Config struct {
|
||||
CustomerAuth AuthConfig
|
||||
DocumentScraper DocumentScraperConfig
|
||||
AISummarizer AISummarizerConfig
|
||||
GoRules GoRulesConfig
|
||||
}
|
||||
|
||||
type ScraperConfig struct {
|
||||
@@ -77,3 +78,11 @@ type AISummarizerConfig struct {
|
||||
MinioRegion string `env:"AI_SUMMARIZER_MINIO_REGION" envDefault:"us-east-1"`
|
||||
MinioBucket string `env:"AI_SUMMARIZER_MINIO_BUCKET" envDefault:"opplens-documents"`
|
||||
}
|
||||
|
||||
// GoRulesConfig holds configuration for the GoRules status engine.
|
||||
type GoRulesConfig struct {
|
||||
BaseURL string `env:"GORULES_BASE_URL"`
|
||||
Token string `env:"GORULES_TOKEN"`
|
||||
RuleID string `env:"GORULES_RULE_ID"`
|
||||
Timeout time.Duration `env:"GORULES_TIMEOUT"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user