Compare commits

..

2 Commits

Author SHA1 Message Date
shoopea
8a6fced9c8 version bump 2022-06-19 12:33:37 +08:00
shoopea
fcc9fa3f5c fix fields not exported in json 2022-06-19 12:33:24 +08:00
4 changed files with 12 additions and 12 deletions

View File

@ -36,7 +36,7 @@ func main() {
}
if *testMailFlag {
SendMail(cfg.Email.smtpHost, cfg.Email.fromEmail, "test backup email topic", "test backup email body", cfg.Email.toEmail)
SendMail(cfg.Email.SmtpHost, cfg.Email.FromEmail, "test backup email topic", "test backup email body", cfg.Email.ToEmail)
os.Exit(0)
}
@ -47,7 +47,7 @@ func main() {
}
if len(email.items) > 0 {
SendMail(cfg.Email.smtpHost, cfg.Email.fromEmail, "Autobackup report", fmt.Sprintf("%v", email.items), cfg.Email.toEmail)
SendMail(cfg.Email.SmtpHost, cfg.Email.FromEmail, "Autobackup report", fmt.Sprintf("%v", email.items), cfg.Email.ToEmail)
log.Printf("Sending summary email\r\n%v", email.items)
}
}

View File

@ -54,21 +54,21 @@ func (c *Config) Load() error {
return err
}
if len(cfg.Email.smtpHost) == 0 {
if len(cfg.Email.SmtpHost) == 0 {
if *debugFlag {
log.Printf("Config.Load : no smtp")
}
return fmt.Errorf("no smtp")
}
if len(cfg.Email.fromEmail) == 0 {
if len(cfg.Email.FromEmail) == 0 {
if *debugFlag {
log.Printf("Config.Load : no email from")
}
return fmt.Errorf("no email from")
}
if len(cfg.Email.toEmail) == 0 {
if len(cfg.Email.ToEmail) == 0 {
if *debugFlag {
log.Printf("Config.Load : no email to")
}

View File

@ -14,9 +14,9 @@ type Email struct {
}
type EmailConfig struct {
smtpHost string `json:"smtp"`
fromEmail string `json:"email_from"`
toEmail []string `json:"email_to"`
SmtpHost string `json:"smtp"`
FromEmail string `json:"email_from"`
ToEmail []string `json:"email_to"`
}
func SendMail(addr, from, subject, body string, to []string) error {

View File

@ -1,6 +1,6 @@
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "f2509f0"
var buildstamp = "2022-06-19_04:31:26"
var commits = "48"
var version = "f2509f0-b48 - 2022-06-19_04:31:26"
var githash = "fcc9fa3"
var buildstamp = "2022-06-19_04:33:26"
var commits = "50"
var version = "fcc9fa3-b50 - 2022-06-19_04:33:26"