customer/internal/models/config.go
2024-12-09 13:30:16 +03:00

63 lines
2.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package models
import (
"gitea.pena/PenaSide/common/encrypt"
"gitea.pena/PenaSide/common/mongo"
"github.com/gofiber/fiber/v2"
"github.com/golang-jwt/jwt/v5"
"time"
)
type Config struct {
ClientHttpURL string `env:"CLIENT_HTTP_URL"`
AdminHttpURL string `env:"ADMIN_HTTP_URL"`
GrpcURL string `env:"GRPC_URL"`
GrpcDomain string `env:"GRPC_DOMAIN"`
AuthMicroserviceURL string `env:"AUTH_MICROSERVICE_URL,required"` // http://10.8.0.6:59300/user
HubadminMicroserviceURL string `env:"HUBADMIN_MICROSERVICE_URL,required"` // http://10.8.0.6:59303/tariff
CurrencyMicroserviceURL string `env:"CURRENCY_MICROSERVICE_URL,required"` // http://10.8.0.6:3131/change
DiscountMicroserviceGRPC string `env:"DISCOUNT_MICROSERVICE_GRPC_URL,required"`
CodewordMicroserviceGRPC string `env:"CODEWORD_MICROSERVICE_GRPC_URL,required"`
PaymentMicroserviceGRPC string `env:"PAYMENT_MICROSERVICE_GRPC_URL,required"`
VerificationMicroservice string `env:"VERIFICATION_MICROSERVICE_URL,required"` // http://10.8.0.6:7036/verification
TemplategenMicroserviceURL string `env:"TEMPLATEGEN_MICROSERVICE_URL,required"` // http://10.6.0.17/generator/service
KafkaTopicTariff string `json:"topic" env:"KAFKA_TOPIC_TARIFF,required"`
KafkaBrokers []string `json:"brokers" env:"KAFKA_BROKERS,required"`
TrashLogHost string `env:"TRASH_LOG_HOST"`
NotificationBotToken string `env:"TELEGRAM_TOKEN"`
NotificationChannel int64 `env:"TELEGRAM_NOTIFICATION_CHANNEL_ID"`
AdminURL string `env:"ADMIN_FRONT_URL"`
NotificationRsPayChannel int64 `env:"TELEGRAM_RS_PAY_CHANNEL_ID"`
ExternalCfg ExternalCfg
}
type ExternalCfg struct {
EncryptCommon encrypt.Encrypt
JwtCfg JWTConfiguration
MailClientCfg MailClientCfg
Database mongo.Configuration
}
type MailClientCfg struct {
ApiURL string `env:"API_URL,required"`
Sender string `env:"MAIL_SENDER,required"`
ApiKey string `env:"MAIL_API_KEY,required"`
FiberClient *fiber.Client
MailAddress string `env:"MAIL_ADDRESS,required"`
}
type JWTConfiguration struct {
PrivateKey string `env:"JWT_PRIVATE_KEY"`
PublicKey string `env:"JWT_PUBLIC_KEY,required"`
Issuer string `env:"JWT_ISSUER,required"`
Audience string `env:"JWT_AUDIENCE,required"`
Algorithm jwt.SigningMethodRSA
ExpiresIn time.Duration
}
const mongoVersion uint32 = 1
// после дисскусии с Мишей пришли к выводу что смысла передавать этот парметр через переменные среды нет.
// потому что в зависимости от типа текущего сервиса, тестового/продового он будет с ним ходить в разные сервисы trashlog
const ModuleLogger = "customer"