drop plainAuth for smtp client

This commit is contained in:
Pasha 2024-11-27 13:05:51 +03:00
parent 88f15c9592
commit d4c2e2d6ce
6 changed files with 30 additions and 33 deletions

@ -3,10 +3,10 @@ JWT_ISSUER="pena-auth-service"
JWT_AUDIENCE="pena"
JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHgnvr7O2tiApjJfid1orFnIGm69\n80fZp+Lpbjo+NC/0whMFga2Biw5b1G2Q/B2u0tpO1Fs/E8z7Lv1nYfr5jx2S8x6B\ndA4TS2kB9Kf0wn0+7wSlyikHoKhbtzwXHZl17GsyEi6wHnsqNBSauyIWhpha8i+Y\n+3GyaOY536H47qyXAgMBAAE=\n-----END PUBLIC KEY-----"
EXTERNAL_HTTP_HOST=0.0.0.0
EXTERNAL_HTTP_PORT=8082
INTERNAL_HTTP_HOST=0.0.0.0
INTERNAL_HTTP_PORT=8083
CLIENT_HTTP_HOST=0.0.0.0
CLIENT_HTTP_PORT=8080
ADMIN_HTTP_HOST=0.0.0.0
ADMIN_HTTP_PORT=8081
GRPC_HOST=0.0.0.0
GRPC_PORT=9001
@ -22,12 +22,12 @@ MONGO_AUTH=admin
KAFKA_BROKERS=localhost:9092
KAFKA_TOPIC_TARIFF=test-topic
AUTH_MICROSERVICE_USER_URL=http://localhost:8000/user
HUBADMIN_MICROSERVICE_TARIFF_URL=http://localhost:8001/tariff
CURRENCY_MICROSERVICE_TRANSLATE_URL=http://cbrfworker-service:8000/change
AUTH_MICROSERVICE_URL=http://localhost:8000/user
HUBADMIN_MICROSERVICE_URL=http://localhost:8001/tariff
CURRENCY_MICROSERVICE_URL=http://cbrfworker-service:8000/change
DISCOUNT_MICROSERVICE_GRPC_HOST=localhost:9040
PAYMENT_MICROSERVICE_GRPC_HOST=treasurer-service:9085
VERIFICATION_MICROSERVICE_USER_URL=http://10.8.0.8:7035/verification
VERIFICATION_MICROSERVICE_URL=http://10.8.0.8:7035/verification
TEMPLATEGEN_MICROSERVICE_URL=10.6.0.17
CODEWORD_MICROSERVICE_GRPC_HOST = http://localhost:8000/user
TRASH_LOG_HOST=localhost:7113
@ -35,8 +35,14 @@ TRASH_LOG_HOST=localhost:7113
API_URL=https://api.smtp.bz/v1/smtp/send
MAIL_SENDER=noreply@mailing.pena.digital
MAIL_API_KEY=P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev
MAIL_AUTH_USERNAME=kotilion.95@gmail.com
MAIL_AUTH_PASSWORD=vWwbCSg4bf0p
MAIL_ADDRESS = mail@mail.com
MODULE_LOGGER = local-customer
NOTIFICATION_BOT_TOKEN = 7127966184:AAG1steOCH4wDvHRe9QcsXJPS4dWRyRYsqg
NOTIFICATION_CHANNEL = -1002177203276
NOTIFICATION_RS_PAY_CHANNEL = -1002177203276
ADMIN_FRONT_URL = https://admin-front.ru
ENCRYPT_PUBLIC_KEY = 1
ENCRYPT_PRIVATE_KEY = 2

@ -7,9 +7,9 @@ import (
"os"
"time"
"go.uber.org/zap"
"gitea.pena/PenaSide/customer/internal/app"
"gitea.pena/PenaSide/customer/internal/initialize"
"go.uber.org/zap"
// import for automatically updating linter rules
_ "gitea.pena/PenaSide/linters-golang/pkg/dummy"
)
@ -46,6 +46,8 @@ func main() {
fmt.Println("env configuration: \n", string(configJSON))
fmt.Println(config)
if err := app.Run(config, logger, app.Build{
Commit: commit,
Version: version,

@ -40,8 +40,6 @@ services:
- CODEWORD_MICROSERVICE_GRPC_HOST=10.8.0.6:59665
- MAIL_SENDER=noreply@mailing.pena.digital
- MAIL_API_KEY=P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev
- MAIL_AUTH_USERNAME=kotilion.95@gmail.com
- MAIL_AUTH_PASSWORD=vWwbCSg4bf0p
- MAIL_ADDRESS=sells@pena.digital
- JWT_PUBLIC_KEY=$JWT_PUBLIC_KEY

@ -7,9 +7,7 @@ import (
"gitea.pena/PenaSide/common/mongo"
"gitea.pena/PenaSide/customer/internal/interface/controller/http"
"gitea.pena/PenaSide/trashlog/app"
"gitea.pena/PenaSide/trashlog/wrappers/zaptrashlog"
"github.com/themakers/hlog"
"go.uber.org/zap/zapcore"
tb "gopkg.in/tucnak/telebot.v2"
"os/signal"
"syscall"
@ -47,16 +45,18 @@ func Run(config *models.Config, logger *zap.Logger, build Build) (appErr error)
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
clickHouseLogger, err := zaptrashlog.NewCore(ctx, zap.InfoLevel, config.TrashLogHost, build.Version, build.Commit, build.BuildTime)
if err != nil {
panic(err)
}
//clickHouseLogger, err := zaptrashlog.NewCore(ctx, zap.InfoLevel, config.TrashLogHost, build.Version, build.Commit, build.BuildTime)
//if err != nil {
// panic(err)
//}
loggerForHlog := logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
return zapcore.NewTee(core, clickHouseLogger)
}), zap.AddCallerSkip(2))
var err error
loggerHlog := hlog.New(loggerForHlog).Module(config.ModuleLogger)
//loggerForHlog := logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
// return zapcore.NewTee(core, clickHouseLogger)
//}), zap.AddCallerSkip(2))
loggerHlog := hlog.New(logger).Module(config.ModuleLogger)
loggerHlog.With(models.AllFields{})
loggerHlog.Emit(app.InfoSvcStarted{})

@ -13,7 +13,6 @@ import (
type MailClient struct {
apiUrl string
sender string
auth *models.PlainAuth
apiKey string
fiberClient *fiber.Client
logger *zap.Logger
@ -27,7 +26,6 @@ func NewMailClient(deps models.MailClientCfg, logger *zap.Logger) *MailClient {
return &MailClient{
apiUrl: deps.ApiUrl,
sender: deps.Sender,
auth: deps.Auth,
apiKey: deps.ApiKey,
fiberClient: deps.FiberClient,
logger: logger,

@ -41,18 +41,11 @@ type Config struct {
type MailClientCfg struct {
ApiUrl string `env:"API_URL,required"`
Sender string `env:"MAIL_SENDER,required"`
Auth *PlainAuth
ApiKey string `env:"MAIL_API_KEY,required"`
FiberClient *fiber.Client
MailAddress string `env:"MAIL_ADDRESS,required"`
}
type PlainAuth struct {
Identity string `env:"MAIL_AUTH_IDENTITY"`
Username string `env:"MAIL_AUTH_USERNAME,required"`
Password string `env:"MAIL_AUTH_PASSWORD,required"`
}
type JWTConfiguration struct {
PrivateKey string `env:"JWT_PRIVATE_KEY"`
PublicKey string `env:"JWT_PUBLIC_KEY,required"`