You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
646 B
37 lines
646 B
package message
|
|
|
|
import "sendmsg/global"
|
|
|
|
type Message interface {
|
|
Send(body Body)
|
|
}
|
|
|
|
type Body struct {
|
|
Title string
|
|
Content string
|
|
}
|
|
|
|
func GetType() Message {
|
|
switch global.GLO_CONF.MsgType {
|
|
case "bark":
|
|
return &Bark{
|
|
url: global.GLO_CONF.BarkUrl,
|
|
key: global.GLO_CONF.BarkKey,
|
|
}
|
|
case "mail":
|
|
return &Mail{
|
|
Host: global.GLO_CONF.MailHost,
|
|
Port: global.GLO_CONF.MailPort,
|
|
Username: global.GLO_CONF.MailUser,
|
|
Password: global.GLO_CONF.MailPwd,
|
|
FromName: global.GLO_CONF.MailFromName,
|
|
To: global.GLO_CONF.MailTo,
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Enabled() bool {
|
|
return global.GLO_CONF.MsgEnabled
|
|
}
|