From 9e45db27daa3b682c4d8e1e1aa9e66594cf887a4 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 20 Apr 2020 02:02:15 +0200 Subject: Started with mail creation --- internal/config/config.go | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index 6497ce1..a37cef1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,15 +10,17 @@ import ( type Map map[string]interface{} type GlobalOptions struct { - Timeout int `yaml:"timeout"` - DefaultEmail string `yaml:"default-email"` - Target string `yaml:"target"` + Timeout int `yaml:"timeout"` + DefaultEmail string `yaml:"default-email"` + Target string `yaml:"target"` + Parts []string `yaml:"parts"` } var DefaultGlobalOptions = GlobalOptions{ Timeout: 30, DefaultEmail: username() + "@" + hostname(), Target: "", + Parts: []string{"text", "html"}, } type Config struct { @@ -31,6 +33,26 @@ type Options struct { InclImages *bool `yaml:"include-images"` } +func (c *Config) WithPartText() bool { + for _, part := range c.Parts { + if part == "text" { + return true + } + } + + return false +} + +func (c *Config) WithPartHtml() bool { + for _, part := range c.Parts { + if part == "html" { + return true + } + } + + return false +} + func hostname() (hostname string) { hostname, err := os.Hostname() if err != nil { -- cgit v1.2.3-70-g09d2