31 lines
566 B
Go
31 lines
566 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strconv"
|
|
)
|
|
|
|
type MailConfig struct {
|
|
SMTPHost string
|
|
SMTPPort int
|
|
SMTPSenderName string
|
|
AuthEmail string
|
|
AuthPassword string
|
|
}
|
|
|
|
func Mail() *MailConfig {
|
|
port, err := strconv.Atoi(os.Getenv("SMTP_PORT"))
|
|
if err != nil {
|
|
fmt.Println("error parsing to int", err.Error())
|
|
}
|
|
|
|
return &MailConfig{
|
|
SMTPHost: os.Getenv("SMTP_HOST"),
|
|
SMTPPort: port,
|
|
SMTPSenderName: os.Getenv("SMTP_SENDER"),
|
|
AuthEmail: os.Getenv("AUTH_EMAIL"),
|
|
AuthPassword: os.Getenv("AUTH_PASSWORD"),
|
|
}
|
|
}
|