@@ -365,6 +365,9 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
365
365
}
366
366
}
367
367
for _ , ec := range rcv .EmailConfigs {
368
+ if ec .TLSConfig == nil {
369
+ ec .TLSConfig = c .Global .SMTPTLSConfig
370
+ }
368
371
if ec .Smarthost .String () == "" {
369
372
if c .Global .SMTPSmarthost .String () == "" {
370
373
return fmt .Errorf ("no global SMTP smarthost set" )
@@ -629,12 +632,14 @@ func checkTimeInterval(r *Route, timeIntervals map[string]struct{}) error {
629
632
// DefaultGlobalConfig returns GlobalConfig with default values.
630
633
func DefaultGlobalConfig () GlobalConfig {
631
634
defaultHTTPConfig := commoncfg .DefaultHTTPClientConfig
632
- return GlobalConfig {
633
- ResolveTimeout : model .Duration (5 * time .Minute ),
634
- HTTPConfig : & defaultHTTPConfig ,
635
+ defaultSMTPTLSConfig := commoncfg.TLSConfig {}
635
636
637
+ return GlobalConfig {
638
+ ResolveTimeout : model .Duration (5 * time .Minute ),
639
+ HTTPConfig : & defaultHTTPConfig ,
636
640
SMTPHello : "localhost" ,
637
641
SMTPRequireTLS : true ,
642
+ SMTPTLSConfig : & defaultSMTPTLSConfig ,
638
643
PagerdutyURL : mustParseURL ("https://events.pagerduty.com/v2/enqueue" ),
639
644
OpsGenieAPIURL : mustParseURL ("https://api.opsgenie.com/" ),
640
645
WeChatAPIURL : mustParseURL ("https://qyapi.weixin.qq.com/cgi-bin/" ),
@@ -742,29 +747,30 @@ type GlobalConfig struct {
742
747
743
748
HTTPConfig * commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`
744
749
745
- SMTPFrom string `yaml:"smtp_from,omitempty" json:"smtp_from,omitempty"`
746
- SMTPHello string `yaml:"smtp_hello,omitempty" json:"smtp_hello,omitempty"`
747
- SMTPSmarthost HostPort `yaml:"smtp_smarthost,omitempty" json:"smtp_smarthost,omitempty"`
748
- SMTPAuthUsername string `yaml:"smtp_auth_username,omitempty" json:"smtp_auth_username,omitempty"`
749
- SMTPAuthPassword Secret `yaml:"smtp_auth_password,omitempty" json:"smtp_auth_password,omitempty"`
750
- SMTPAuthPasswordFile string `yaml:"smtp_auth_password_file,omitempty" json:"smtp_auth_password_file,omitempty"`
751
- SMTPAuthSecret Secret `yaml:"smtp_auth_secret,omitempty" json:"smtp_auth_secret,omitempty"`
752
- SMTPAuthIdentity string `yaml:"smtp_auth_identity,omitempty" json:"smtp_auth_identity,omitempty"`
753
- SMTPRequireTLS bool `yaml:"smtp_require_tls" json:"smtp_require_tls,omitempty"`
754
- SlackAPIURL * SecretURL `yaml:"slack_api_url,omitempty" json:"slack_api_url,omitempty"`
755
- SlackAPIURLFile string `yaml:"slack_api_url_file,omitempty" json:"slack_api_url_file,omitempty"`
756
- PagerdutyURL * URL `yaml:"pagerduty_url,omitempty" json:"pagerduty_url,omitempty"`
757
- OpsGenieAPIURL * URL `yaml:"opsgenie_api_url,omitempty" json:"opsgenie_api_url,omitempty"`
758
- OpsGenieAPIKey Secret `yaml:"opsgenie_api_key,omitempty" json:"opsgenie_api_key,omitempty"`
759
- OpsGenieAPIKeyFile string `yaml:"opsgenie_api_key_file,omitempty" json:"opsgenie_api_key_file,omitempty"`
760
- WeChatAPIURL * URL `yaml:"wechat_api_url,omitempty" json:"wechat_api_url,omitempty"`
761
- WeChatAPISecret Secret `yaml:"wechat_api_secret,omitempty" json:"wechat_api_secret,omitempty"`
762
- WeChatAPICorpID string `yaml:"wechat_api_corp_id,omitempty" json:"wechat_api_corp_id,omitempty"`
763
- VictorOpsAPIURL * URL `yaml:"victorops_api_url,omitempty" json:"victorops_api_url,omitempty"`
764
- VictorOpsAPIKey Secret `yaml:"victorops_api_key,omitempty" json:"victorops_api_key,omitempty"`
765
- VictorOpsAPIKeyFile string `yaml:"victorops_api_key_file,omitempty" json:"victorops_api_key_file,omitempty"`
766
- TelegramAPIUrl * URL `yaml:"telegram_api_url,omitempty" json:"telegram_api_url,omitempty"`
767
- WebexAPIURL * URL `yaml:"webex_api_url,omitempty" json:"webex_api_url,omitempty"`
750
+ SMTPFrom string `yaml:"smtp_from,omitempty" json:"smtp_from,omitempty"`
751
+ SMTPHello string `yaml:"smtp_hello,omitempty" json:"smtp_hello,omitempty"`
752
+ SMTPSmarthost HostPort `yaml:"smtp_smarthost,omitempty" json:"smtp_smarthost,omitempty"`
753
+ SMTPAuthUsername string `yaml:"smtp_auth_username,omitempty" json:"smtp_auth_username,omitempty"`
754
+ SMTPAuthPassword Secret `yaml:"smtp_auth_password,omitempty" json:"smtp_auth_password,omitempty"`
755
+ SMTPAuthPasswordFile string `yaml:"smtp_auth_password_file,omitempty" json:"smtp_auth_password_file,omitempty"`
756
+ SMTPAuthSecret Secret `yaml:"smtp_auth_secret,omitempty" json:"smtp_auth_secret,omitempty"`
757
+ SMTPAuthIdentity string `yaml:"smtp_auth_identity,omitempty" json:"smtp_auth_identity,omitempty"`
758
+ SMTPRequireTLS bool `yaml:"smtp_require_tls" json:"smtp_require_tls,omitempty"`
759
+ SMTPTLSConfig * commoncfg.TLSConfig `yaml:"smtp_tls_config,omitempty" json:"smtp_tls_config,omitempty"`
760
+ SlackAPIURL * SecretURL `yaml:"slack_api_url,omitempty" json:"slack_api_url,omitempty"`
761
+ SlackAPIURLFile string `yaml:"slack_api_url_file,omitempty" json:"slack_api_url_file,omitempty"`
762
+ PagerdutyURL * URL `yaml:"pagerduty_url,omitempty" json:"pagerduty_url,omitempty"`
763
+ OpsGenieAPIURL * URL `yaml:"opsgenie_api_url,omitempty" json:"opsgenie_api_url,omitempty"`
764
+ OpsGenieAPIKey Secret `yaml:"opsgenie_api_key,omitempty" json:"opsgenie_api_key,omitempty"`
765
+ OpsGenieAPIKeyFile string `yaml:"opsgenie_api_key_file,omitempty" json:"opsgenie_api_key_file,omitempty"`
766
+ WeChatAPIURL * URL `yaml:"wechat_api_url,omitempty" json:"wechat_api_url,omitempty"`
767
+ WeChatAPISecret Secret `yaml:"wechat_api_secret,omitempty" json:"wechat_api_secret,omitempty"`
768
+ WeChatAPICorpID string `yaml:"wechat_api_corp_id,omitempty" json:"wechat_api_corp_id,omitempty"`
769
+ VictorOpsAPIURL * URL `yaml:"victorops_api_url,omitempty" json:"victorops_api_url,omitempty"`
770
+ VictorOpsAPIKey Secret `yaml:"victorops_api_key,omitempty" json:"victorops_api_key,omitempty"`
771
+ VictorOpsAPIKeyFile string `yaml:"victorops_api_key_file,omitempty" json:"victorops_api_key_file,omitempty"`
772
+ TelegramAPIUrl * URL `yaml:"telegram_api_url,omitempty" json:"telegram_api_url,omitempty"`
773
+ WebexAPIURL * URL `yaml:"webex_api_url,omitempty" json:"webex_api_url,omitempty"`
768
774
}
769
775
770
776
// UnmarshalYAML implements the yaml.Unmarshaler interface for GlobalConfig.
0 commit comments