config test

This commit is contained in:
shoopea
2022-06-19 12:27:25 +08:00
parent a5b2d51cfb
commit f2509f0ca6
3 changed files with 14 additions and 5 deletions

View File

@@ -15,9 +15,9 @@ import (
type Config struct {
Zfsnap map[string]string `json:"zfsnap"`
Box map[string]*Box `json:"box"`
Email EmailConfig `json:"email"`
Apps []AppConfig `json:"apps"`
Timezone string `json:"timezone"`
Email EmailConfig `json:"email"`
Now time.Time `json:"-"`
}
@@ -50,6 +50,13 @@ func (c *Config) Load() error {
return err
}
if len(cfg.Email.smtpHost) == 0 || len(cfg.Email.fromEmail) == 0 || len(cfg.Email.toEmail) == 0 {
if *debugFlag {
log.Printf("Config.Load : no email")
}
return fmt.Errorf("no email")
}
c.Now = time.Now().In(l)
for k, v := range c.Box {