Move SMTP credentials to .env file
This commit is contained in:
5
.env
5
.env
@ -13,5 +13,10 @@ DB_USERNAME=root
|
||||
DB_PASSWORD=test123
|
||||
DB_NAME=filekeeper
|
||||
|
||||
SMTP_HOST=mail.fossy.my.id
|
||||
SMTP_PORT=25
|
||||
SMTP_USER=test@fossy.my.id
|
||||
SMTP_PASSWORD=Test123456
|
||||
|
||||
SESSION_NAME=Session
|
||||
SESSION_MAX_AGE=604800
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,5 +4,7 @@
|
||||
/log
|
||||
/.idea
|
||||
|
||||
.env
|
||||
|
||||
*_templ.txt
|
||||
*_templ.go
|
@ -15,6 +15,7 @@ import (
|
||||
forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@ -34,7 +35,8 @@ var UserForgotPassword = make(map[string]string)
|
||||
func init() {
|
||||
log = logger.Logger()
|
||||
ListForgotPassword = make(map[string]*ForgotPassword)
|
||||
mailServer = email.NewSmtpServer("mail.fossy.my.id", 25, "test@fossy.my.id", "Test123456")
|
||||
smtpPort, _ := strconv.Atoi(utils.Getenv("SMTP_PORT"))
|
||||
mailServer = email.NewSmtpServer(utils.Getenv("SMTP_HOST"), smtpPort, utils.Getenv("SMTP_USER"), utils.Getenv("SMTP_PASSWORD"))
|
||||
ticker := time.NewTicker(time.Minute)
|
||||
go func() {
|
||||
for {
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@ -34,7 +35,8 @@ var VerifyEmail map[string]string
|
||||
|
||||
func init() {
|
||||
log = logger.Logger()
|
||||
mailServer = email.NewSmtpServer("mail.fossy.my.id", 25, "test@fossy.my.id", "Test123456")
|
||||
smtpPort, _ := strconv.Atoi(utils.Getenv("SMTP_PORT"))
|
||||
mailServer = email.NewSmtpServer(utils.Getenv("SMTP_HOST"), smtpPort, utils.Getenv("SMTP_USER"), utils.Getenv("SMTP_PASSWORD"))
|
||||
VerifyUser = make(map[string]*UnverifiedUser)
|
||||
VerifyEmail = make(map[string]string)
|
||||
|
||||
|
Reference in New Issue
Block a user