This commit is contained in:
shoopea 2022-06-19 12:31:36 +08:00
parent f2509f0ca6
commit 55d1c2330d
2 changed files with 25 additions and 7 deletions

View File

@ -42,6 +42,10 @@ func (c *Config) Load() error {
return err return err
} }
if *debugFlag {
log.Printf("Config.Load :\r\n%v", cfg)
}
l, err := time.LoadLocation(cfg.Timezone) l, err := time.LoadLocation(cfg.Timezone)
if err != nil { if err != nil {
if *debugFlag { if *debugFlag {
@ -50,11 +54,25 @@ func (c *Config) Load() error {
return err return err
} }
if len(cfg.Email.smtpHost) == 0 || len(cfg.Email.fromEmail) == 0 || len(cfg.Email.toEmail) == 0 { if len(cfg.Email.smtpHost) == 0 {
if *debugFlag { if *debugFlag {
log.Printf("Config.Load : no email") log.Printf("Config.Load : no smtp")
} }
return fmt.Errorf("no email") return fmt.Errorf("no smtp")
}
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 *debugFlag {
log.Printf("Config.Load : no email to")
}
return fmt.Errorf("no email to")
} }
c.Now = time.Now().In(l) c.Now = time.Now().In(l)

View File

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