feat: initialized smtp service;
refactor: config now returns a copy of a struct to prevent editing; chore: corrected identation
This commit is contained in:
@@ -153,7 +153,7 @@ func Load() (*Config, error) {
|
|||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig() *Config {
|
func GetConfig() Config {
|
||||||
|
|
||||||
if config == nil {
|
if config == nil {
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ func GetConfig() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return *config
|
||||||
}
|
}
|
||||||
|
|
||||||
var config *Config
|
var config *Config
|
||||||
|
|||||||
10
backend/internal/errors/smtp.go
Normal file
10
backend/internal/errors/smtp.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package errors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrSmtpDisabled = errors.New("Smtp is not enabled in the config")
|
||||||
|
ErrSmtpSendFailure = errors.New("Failed to send email")
|
||||||
|
)
|
||||||
@@ -16,3 +16,22 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package services
|
package services
|
||||||
|
|
||||||
|
import "go.uber.org/zap"
|
||||||
|
|
||||||
|
type SmtpService interface {
|
||||||
|
SendEmail(to string, content string)
|
||||||
|
}
|
||||||
|
|
||||||
|
type smtpServiceImpl struct {
|
||||||
|
log *zap.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSmtpService(_log *zap.Logger) SmtpService {
|
||||||
|
return &smtpServiceImpl{log: _log}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *smtpServiceImpl) SendEmail(to string, content string) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user