@@ -636,15 +636,16 @@ type WechatConfig struct {
636636
637637 HTTPConfig * commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`
638638
639- APISecret Secret `yaml:"api_secret,omitempty" json:"api_secret,omitempty"`
640- CorpID string `yaml:"corp_id,omitempty" json:"corp_id,omitempty"`
641- Message string `yaml:"message,omitempty" json:"message,omitempty"`
642- APIURL * URL `yaml:"api_url,omitempty" json:"api_url,omitempty"`
643- ToUser string `yaml:"to_user,omitempty" json:"to_user,omitempty"`
644- ToParty string `yaml:"to_party,omitempty" json:"to_party,omitempty"`
645- ToTag string `yaml:"to_tag,omitempty" json:"to_tag,omitempty"`
646- AgentID string `yaml:"agent_id,omitempty" json:"agent_id,omitempty"`
647- MessageType string `yaml:"message_type,omitempty" json:"message_type,omitempty"`
639+ APISecret Secret `yaml:"api_secret,omitempty" json:"api_secret,omitempty"`
640+ APISecretFile string `yaml:"api_secret_file,omitempty" json:"api_secret_file,omitempty"`
641+ CorpID string `yaml:"corp_id,omitempty" json:"corp_id,omitempty"`
642+ Message string `yaml:"message,omitempty" json:"message,omitempty"`
643+ APIURL * URL `yaml:"api_url,omitempty" json:"api_url,omitempty"`
644+ ToUser string `yaml:"to_user,omitempty" json:"to_user,omitempty"`
645+ ToParty string `yaml:"to_party,omitempty" json:"to_party,omitempty"`
646+ ToTag string `yaml:"to_tag,omitempty" json:"to_tag,omitempty"`
647+ AgentID string `yaml:"agent_id,omitempty" json:"agent_id,omitempty"`
648+ MessageType string `yaml:"message_type,omitempty" json:"message_type,omitempty"`
648649}
649650
650651const wechatValidTypesRe = `^(text|markdown)$`
@@ -667,6 +668,10 @@ func (c *WechatConfig) UnmarshalYAML(unmarshal func(any) error) error {
667668 return fmt .Errorf ("weChat message type %q does not match valid options %s" , c .MessageType , wechatValidTypesRe )
668669 }
669670
671+ if c .APISecret != "" && len (c .APISecretFile ) > 0 {
672+ return errors .New ("at most one of api_secret & api_secret_file must be configured" )
673+ }
674+
670675 return nil
671676}
672677
0 commit comments