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

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
config.json
backup

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 {

View File

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