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_PASSWORD=test123
|
||||||
DB_NAME=filekeeper
|
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_NAME=Session
|
||||||
SESSION_MAX_AGE=604800
|
SESSION_MAX_AGE=604800
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,5 +4,7 @@
|
|||||||
/log
|
/log
|
||||||
/.idea
|
/.idea
|
||||||
|
|
||||||
|
.env
|
||||||
|
|
||||||
*_templ.txt
|
*_templ.txt
|
||||||
*_templ.go
|
*_templ.go
|
@ -15,6 +15,7 @@ import (
|
|||||||
forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword"
|
forgotPasswordView "github.com/fossyy/filekeeper/view/forgotPassword"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -34,7 +35,8 @@ var UserForgotPassword = make(map[string]string)
|
|||||||
func init() {
|
func init() {
|
||||||
log = logger.Logger()
|
log = logger.Logger()
|
||||||
ListForgotPassword = make(map[string]*ForgotPassword)
|
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)
|
ticker := time.NewTicker(time.Minute)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -34,7 +35,8 @@ var VerifyEmail map[string]string
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log = logger.Logger()
|
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)
|
VerifyUser = make(map[string]*UnverifiedUser)
|
||||||
VerifyEmail = make(map[string]string)
|
VerifyEmail = make(map[string]string)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user