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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user