-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
34 lines (27 loc) · 1.02 KB
/
Copy pathconfig.go
File metadata and controls
34 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package internal
import "fmt"
type Config struct {
// ServerHost and ServerPort are used for listening incoming connections.
// By default, it allows the server to respond to requests from any
// available network interface.
ServerHost string `env:"SERVER_HOST" env-default:"0.0.0.0"`
ServerPort string `env:"SERVER_PORT" env-default:"25"`
Host string `env:"SMTP_HOST" env-default:"smtp.gmail.com"`
Port string `env:"SMTP_PORT" env-default:"587"`
User string `env:"SMTP_USER"`
Pass string `env:"SMTP_PASS"`
StartTLS bool `env:"SMTP_TLS" env-default:"true"`
Auth bool `env:"SMTP_AUTH" env-default:"true"`
// Slack token for sending notifications.
// https://api.slack.com/authentication/token-types#granular_bot
SlackToken string `env:"SLACK_TOKEN"`
}
func (c *Config) Insecure() bool {
return !c.StartTLS
}
func (c *Config) RelayAddr() string {
return fmt.Sprintf("%s:%s", c.ServerHost, c.ServerPort)
}
func (c *Config) SMTPAddr() string {
return fmt.Sprintf("%s:%s", c.Host, c.Port)
}