refactor: workflow condition node
refactor: workflow condition node
This commit is contained in:
@@ -30,9 +30,9 @@ func NewNotifyNode(node *domain.WorkflowNode) *notifyNode {
|
||||
func (n *notifyNode) Process(ctx context.Context) error {
|
||||
n.logger.Info("ready to send notification ...")
|
||||
|
||||
nodeConfig := n.node.GetConfigForNotify()
|
||||
nodeCfg := n.node.GetConfigForNotify()
|
||||
|
||||
if nodeConfig.Provider == "" {
|
||||
if nodeCfg.Provider == "" {
|
||||
// Deprecated: v0.4.x 将废弃
|
||||
// 兼容旧版本的通知渠道
|
||||
n.logger.Warn("WARNING! you are using the notification channel from global settings, which will be deprecated in the future")
|
||||
@@ -44,14 +44,14 @@ func (n *notifyNode) Process(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// 获取通知渠道
|
||||
channelConfig, err := settings.GetNotifyChannelConfig(nodeConfig.Channel)
|
||||
channelConfig, err := settings.GetNotifyChannelConfig(nodeCfg.Channel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 发送通知
|
||||
if err := notify.SendToChannel(nodeConfig.Subject, nodeConfig.Message, nodeConfig.Channel, channelConfig); err != nil {
|
||||
n.logger.Warn("failed to send notification", slog.String("channel", nodeConfig.Channel))
|
||||
if err := notify.SendToChannel(nodeCfg.Subject, nodeCfg.Message, nodeCfg.Channel, channelConfig); err != nil {
|
||||
n.logger.Warn("failed to send notification", slog.String("channel", nodeCfg.Channel))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ func (n *notifyNode) Process(ctx context.Context) error {
|
||||
deployer, err := notify.NewWithWorkflowNode(notify.NotifierWithWorkflowNodeConfig{
|
||||
Node: n.node,
|
||||
Logger: n.logger,
|
||||
Subject: nodeConfig.Subject,
|
||||
Message: nodeConfig.Message,
|
||||
Subject: nodeCfg.Subject,
|
||||
Message: nodeCfg.Message,
|
||||
})
|
||||
if err != nil {
|
||||
n.logger.Warn("failed to create notifier provider")
|
||||
|
||||
Reference in New Issue
Block a user