diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-20 18:45:43 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-20 18:45:43 +0200 |
commit | afe2c4919dc2ded2f3b7d796b914dd66fbe78e64 (patch) | |
tree | febdd45c23807fa1e9c22078b7927cd39956f308 /internal | |
parent | 47fa4464d7cf028dd871d48bf6472d97f60b4a79 (diff) | |
download | feed2imap-go-afe2c4919dc2ded2f3b7d796b914dd66fbe78e64.tar.gz feed2imap-go-afe2c4919dc2ded2f3b7d796b914dd66fbe78e64.tar.bz2 feed2imap-go-afe2c4919dc2ded2f3b7d796b914dd66fbe78e64.zip |
Fixes and validation
Diffstat (limited to '')
-rw-r--r-- | internal/config/config.go | 9 | ||||
-rw-r--r-- | internal/imap/imap.go | 3 | ||||
-rw-r--r-- | internal/yaml/yaml.go | 5 |
3 files changed, 15 insertions, 2 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index a37cef1..409cbdf 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,6 +1,7 @@ package config import ( + "fmt" "os" "os/user" "runtime" @@ -33,6 +34,14 @@ type Options struct { InclImages *bool `yaml:"include-images"` } +func (c *Config) Validate() error { + if c.Target == "" { + return fmt.Errorf("No target set!") + } + + return nil +} + func (c *Config) WithPartText() bool { for _, part := range c.Parts { if part == "text" { diff --git a/internal/imap/imap.go b/internal/imap/imap.go index f2a9082..2fd7580 100644 --- a/internal/imap/imap.go +++ b/internal/imap/imap.go @@ -99,8 +99,9 @@ func Connect(url *url.URL) (*Client, error) { } log.Print("Connected to ", url.Host, " (STARTTLS)") + } else { + log.Print("Connected to ", url.Host, " (Plain)") } - log.Print("Connected to ", url.Host, " (Plain)") } pwd, _ := url.User.Password() diff --git a/internal/yaml/yaml.go b/internal/yaml/yaml.go index 3317f5d..207adab 100644 --- a/internal/yaml/yaml.go +++ b/internal/yaml/yaml.go @@ -128,5 +128,8 @@ func Load(path string) (C.Config, F.Feeds, error) { return C.Config{}, nil, fmt.Errorf("while parsing: %w", err) } - return C.Config{GlobalConfig: parsedCfg.GlobalConfig}, feeds, nil + return C.Config{ + GlobalOptions: parsedCfg.GlobalOptions, + GlobalConfig: parsedCfg.GlobalConfig, + }, feeds, nil } |