refactor(config): make config.Channel to multiple instance support
add new field type to Channel struct config.channels refactor to channel_list update config version to 3 update the docs
This commit is contained in:
1 parent
2b2bc26f8e
commit
667fc85d54
185 files changed
+6389
-4180
No files matched your search
@@ -7,7 +7,19 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
channels.RegisterFactory("feishu", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
|
||||
return NewFeishuChannel(cfg.Channels.Feishu, b)
|
||||
})
|
||||
channels.RegisterFactory(
|
||||
config.ChannelFeishu,
|
||||
func(channelName, channelType string, cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
|
||||
bc := cfg.Channels[channelName]
|
||||
decoded, err := bc.GetDecoded()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c, ok := decoded.(*config.FeishuSettings)
|
||||
if !ok {
|
||||
return nil, channels.ErrSendFailed
|
||||
}
|
||||
return NewFeishuChannel(bc, c, b)
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user