@@ -479,6 +479,10 @@ func (c *Config) UnmarshalYAML(unmarshal func(any) error) error {
479479 }
480480 }
481481
482+ if c .Global .MattermostAPIURL != nil && len (c .Global .MattermostAPIURLFile ) > 0 {
483+ return errors .New ("at most one of mattermost_api_url & mattermost_api_url_file must be configured" )
484+ }
485+
482486 if c .Global .OpsGenieAPIKey != "" && len (c .Global .OpsGenieAPIKeyFile ) > 0 {
483487 return errors .New ("at most one of opsgenie_api_key & opsgenie_api_key_file must be configured" )
484488 }
@@ -773,6 +777,10 @@ func (c *Config) UnmarshalYAML(unmarshal func(any) error) error {
773777 if mattermost .HTTPConfig == nil {
774778 mattermost .HTTPConfig = c .Global .HTTPConfig
775779 }
780+ if mattermost .WebhookURL == nil && len (mattermost .WebhookURLFile ) == 0 {
781+ mattermost .WebhookURL = c .Global .MattermostAPIURL
782+ mattermost .WebhookURLFile = c .Global .MattermostAPIURLFile
783+ }
776784 }
777785
778786 names [rcv .Name ] = struct {}{}
@@ -994,6 +1002,8 @@ type GlobalConfig struct {
9941002 SMTPTLSConfig * commoncfg.TLSConfig `yaml:"smtp_tls_config,omitempty" json:"smtp_tls_config,omitempty"`
9951003 SlackAPIURL * SecretURL `yaml:"slack_api_url,omitempty" json:"slack_api_url,omitempty"`
9961004 SlackAPIURLFile string `yaml:"slack_api_url_file,omitempty" json:"slack_api_url_file,omitempty"`
1005+ MattermostAPIURL * SecretURL `yaml:"mattermost_api_url,omitempty" json:"mattermost_api_url,omitempty"`
1006+ MattermostAPIURLFile string `yaml:"mattermost_api_url_file,omitempty" json:"mattermost_api_url_file,omitempty"`
9971007 SlackAppToken Secret `yaml:"slack_app_token,omitempty" json:"slack_app_token,omitempty"`
9981008 SlackAppTokenFile string `yaml:"slack_app_token_file,omitempty" json:"slack_app_token_file,omitempty"`
9991009 SlackAppURL * URL `yaml:"slack_app_url,omitempty" json:"slack_app_url,omitempty"`
0 commit comments