go-rules temporarily disabled

This commit is contained in:
Mazyar
2026-05-30 16:19:21 +03:30
parent e869e149c5
commit bca94cd69a
4 changed files with 45 additions and 32 deletions
+33 -26
View File
@@ -362,34 +362,41 @@ func InitAISummarizerStorage(conf AISummarizerConfig, log logger.Logger) *ai_sum
} }
// InitGoRulesClient initializes the GoRules SDK client. // InitGoRulesClient initializes the GoRules SDK client.
func InitGoRulesClient(conf GoRulesConfig, log logger.Logger) gorules.Client { func InitGoRulesClient(_ GoRulesConfig, log logger.Logger) gorules.Client {
if conf.BaseURL == "" || conf.Token == "" || conf.RuleID == "" { // GoRules SDK temporarily disabled — gorulessdk private repo unreachable from server.
log.Warn("GoRules client not configured, falling back to static Kanban statuses", map[string]interface{}{}) // Kanban falls back to built-in bid workflow columns when client is nil.
return nil log.Warn("GoRules client disabled; Kanban uses built-in bid workflow columns", map[string]interface{}{})
} return nil
timeout := conf.Timeout /*
if timeout <= 0 { if conf.BaseURL == "" || conf.Token == "" || conf.RuleID == "" {
timeout = 10 * time.Second log.Warn("GoRules client not configured, falling back to static Kanban statuses", map[string]interface{}{})
} return nil
}
client, err := gorules.New(gorules.Config{ timeout := conf.Timeout
BaseURL: conf.BaseURL, if timeout <= 0 {
Token: conf.Token, timeout = 10 * time.Second
Timeout: timeout, }
}, log)
if err != nil { client, err := gorules.New(gorules.Config{
log.Error("Failed to initialize GoRules client", map[string]interface{}{ BaseURL: conf.BaseURL,
"error": err.Error(), 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 nil
}
log.Info("GoRules client initialized successfully", map[string]interface{}{ return client
"base_url": conf.BaseURL, */
"timeout": timeout,
"rule_id": conf.RuleID,
})
return client
} }
+1 -1
View File
@@ -18,7 +18,7 @@ require (
go.uber.org/zap v1.26.0 go.uber.org/zap v1.26.0
golang.org/x/crypto v0.40.0 golang.org/x/crypto v0.40.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/natefinch/lumberjack.v2 v2.2.1
repo.ravanertebat.com/k.khodayari/gorulessdk v1.0.10 // repo.ravanertebat.com/k.khodayari/gorulessdk v1.0.10 // temporarily disabled: private repo unreachable from server
) )
require ( require (
-2
View File
@@ -163,5 +163,3 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
repo.ravanertebat.com/k.khodayari/gorulessdk v1.0.10 h1:xxNnEyXr6v9wWb3nv2YpRDJ+2kEX7s588RdD6mGqwWI=
repo.ravanertebat.com/k.khodayari/gorulessdk v1.0.10/go.mod h1:SqAyTO7MZgI20+E1/xedUGHGWU5uyphZ2izHx62Rsr0=
+11 -3
View File
@@ -3,16 +3,17 @@ package gorules
import ( import (
"context" "context"
"errors" "errors"
"strings"
"time" "time"
"tm/pkg/logger" "tm/pkg/logger"
"repo.ravanertebat.com/k.khodayari/gorulessdk" // "repo.ravanertebat.com/k.khodayari/gorulessdk" // temporarily disabled: private repo unreachable from server
) )
/*
const ( const (
showAvailableStatusAction = gorulessdk.ShowAvailableStatus showAvailableStatusAction = gorulessdk.ShowAvailableStatus
) )
*/
// Config contains GoRules client configuration. // Config contains GoRules client configuration.
type Config struct { type Config struct {
@@ -32,12 +33,18 @@ type Client interface {
EvaluateAvailableStatuses(ctx context.Context, currentStatus string, ruleID string) ([]StatusWithCategory, error) EvaluateAvailableStatuses(ctx context.Context, currentStatus string, ruleID string) ([]StatusWithCategory, error)
} }
// New creates a new GoRules client.
// Temporarily disabled: gorulessdk is unavailable from the deployment server.
func New(_ Config, _ logger.Logger) (Client, error) {
return nil, errors.New("gorulessdk temporarily disabled")
}
/*
type sdkClient struct { type sdkClient struct {
client *gorulessdk.Client client *gorulessdk.Client
logger logger.Logger logger logger.Logger
} }
// New creates a new GoRules client.
func New(cfg Config, log logger.Logger) (Client, error) { func New(cfg Config, log logger.Logger) (Client, error) {
if strings.TrimSpace(cfg.BaseURL) == "" { if strings.TrimSpace(cfg.BaseURL) == "" {
return nil, errors.New("gorules base url is required") return nil, errors.New("gorules base url is required")
@@ -83,3 +90,4 @@ func (s *sdkClient) EvaluateAvailableStatuses(ctx context.Context, currentStatus
} }
return statuses, nil return statuses, nil
} }
*/