add: plaintext email; improved templating
This commit is contained in:
@@ -33,7 +33,6 @@ type SMTPConfig struct {
|
||||
Host string `json:"Host" envconfig:"SMTP_HOST"`
|
||||
User string `json:"User" envconfig:"SMTP_USER"`
|
||||
Password string `json:"Password" envconfig:"SMTP_PASS"`
|
||||
Mailtype string `json:"Mailtype" default:"html" envconfig:"MAIL_TYPE"`
|
||||
AdminEmail string `json:"AdminEmail" envconfig:"ADMIN_MAIL"`
|
||||
Port int `json:"Port" default:"465" envconfig:"SMTP_PORT"`
|
||||
}
|
||||
@@ -42,6 +41,7 @@ type TemplateConfig struct {
|
||||
MailPath string `json:"MailPath" default:"templates/email" envconfig:"TEMPLATE_MAIL_PATH"`
|
||||
HTMLPath string `json:"HTMLPath" default:"templates/html" envconfig:"TEMPLATE_HTML_PATH"`
|
||||
StaticPath string `json:"StaticPath" default:"templates/css" envconfig:"TEMPLATE_STATIC_PATH"`
|
||||
LogoURI string `json:"LogoURI" envconfig:"LOGO_URI"`
|
||||
}
|
||||
|
||||
type RecipientsConfig struct {
|
||||
@@ -60,6 +60,7 @@ type Config struct {
|
||||
Templates TemplateConfig `json:"templates"`
|
||||
Recipients RecipientsConfig `json:"recipients"`
|
||||
ConfigFilePath string `json:"config_file_path" envconfig:"CONFIG_FILE_PATH"`
|
||||
WebsiteTitle string `json:"WebsiteTitle" envconfig:"WEBSITE_TITLE"`
|
||||
BaseURL string `json:"BaseUrl" envconfig:"BASE_URL"`
|
||||
Env string `json:"Environment" default:"development" envconfig:"ENV"`
|
||||
DB DatabaseConfig `json:"db"`
|
||||
@@ -68,16 +69,17 @@ type Config struct {
|
||||
}
|
||||
|
||||
var (
|
||||
BaseURL string
|
||||
CFGPath string
|
||||
CFG Config
|
||||
Auth AuthenticationConfig
|
||||
DB DatabaseConfig
|
||||
Templates TemplateConfig
|
||||
SMTP SMTPConfig
|
||||
Recipients RecipientsConfig
|
||||
Env string
|
||||
Security SecurityConfig
|
||||
BaseURL string
|
||||
WebsiteTitle string
|
||||
CFGPath string
|
||||
CFG Config
|
||||
Auth AuthenticationConfig
|
||||
DB DatabaseConfig
|
||||
Templates TemplateConfig
|
||||
SMTP SMTPConfig
|
||||
Recipients RecipientsConfig
|
||||
Env string
|
||||
Security SecurityConfig
|
||||
)
|
||||
var environmentOptions map[string]bool = map[string]bool{
|
||||
"development": true,
|
||||
@@ -117,6 +119,7 @@ func LoadConfig() {
|
||||
Recipients = CFG.Recipients
|
||||
Security = CFG.Security
|
||||
Env = CFG.Env
|
||||
WebsiteTitle = CFG.WebsiteTitle
|
||||
logger.Info.Printf("Config loaded: %#v", CFG)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user