2023-06-22 09:36:43 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/golang-jwt/jwt/v5"
|
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/mongo"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
HTTP ConfigurationHTTP
|
|
|
|
GRPC ConfigurationGRPC
|
|
|
|
Service ServiceConfiguration
|
|
|
|
Database mongo.Configuration
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConfigurationHTTP struct {
|
|
|
|
Host string `env:"HTTP_HOST,default=localhost"`
|
|
|
|
Port string `env:"HTTP_PORT,default=8080"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConfigurationGRPC struct {
|
|
|
|
Host string `env:"GRPC_HOST,default=localhost"`
|
|
|
|
Port string `env:"GRPC_PORT,default=8081"`
|
|
|
|
Domen string `env:"GRPC_DOMEN,default=https://domen.ru"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ServiceConfiguration struct {
|
2023-11-26 13:02:01 +00:00
|
|
|
AuthMicroservice AuthMicroserviceConfiguration
|
|
|
|
HubadminMicroservice HubadminMicroserviceConfiguration
|
|
|
|
CurrencyMicroservice CurrencyMicroserviceConfiguration
|
|
|
|
DiscountMicroservice DiscountMicroserviceConfiguration
|
|
|
|
PaymentMicroservice PaymentMicroserviceConfiguration
|
|
|
|
VerificationMicroservice VerificationMicroserviceConfiguration
|
|
|
|
TemplategenMicroserviceURL TemplategenMicroserviceConfiguration
|
|
|
|
JWT JWTConfiguration
|
|
|
|
Kafka KafkaConfiguration
|
2023-07-07 01:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type KafkaConfiguration struct {
|
|
|
|
Tariff TariffKafkaConfiguration `json:"tariff"`
|
|
|
|
Brokers []string `json:"brokers" env:"KAFKA_BROKERS,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TariffKafkaConfiguration struct {
|
|
|
|
Topic string `json:"topic" env:"KAFKA_TOPIC_TARIFF,required"`
|
2023-06-22 09:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
type AuthMicroserviceConfiguration struct {
|
|
|
|
URL AuthMicroserviceURL
|
|
|
|
}
|
|
|
|
|
|
|
|
type HubadminMicroserviceConfiguration struct {
|
|
|
|
URL HubadminMicroserviceURL
|
|
|
|
}
|
|
|
|
|
|
|
|
type CurrencyMicroserviceConfiguration struct {
|
|
|
|
URL CurrencyMicroserviceURL
|
|
|
|
}
|
|
|
|
|
2023-11-26 13:02:01 +00:00
|
|
|
type VerificationMicroserviceConfiguration struct {
|
|
|
|
URL VerificationMicroserviceURL
|
|
|
|
}
|
|
|
|
|
|
|
|
type TemplategenMicroserviceConfiguration struct {
|
|
|
|
URL TemplategenMicroserviceURL
|
|
|
|
}
|
|
|
|
|
2023-06-22 09:36:43 +00:00
|
|
|
type PaymentMicroserviceConfiguration struct {
|
|
|
|
HostGRPC string `env:"PAYMENT_MICROSERVICE_GRPC_HOST,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DiscountMicroserviceConfiguration struct {
|
|
|
|
HostGRPC string `env:"DISCOUNT_MICROSERVICE_GRPC_HOST,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type AuthMicroserviceURL struct {
|
|
|
|
User string `env:"AUTH_MICROSERVICE_USER_URL,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type HubadminMicroserviceURL struct {
|
|
|
|
Tariff string `env:"HUBADMIN_MICROSERVICE_TARIFF_URL,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CurrencyMicroserviceURL struct {
|
|
|
|
Translate string `env:"CURRENCY_MICROSERVICE_TRANSLATE_URL,required"`
|
|
|
|
}
|
2023-11-26 13:02:01 +00:00
|
|
|
|
|
|
|
type VerificationMicroserviceURL struct {
|
|
|
|
Verification string `env:"VERIFICATION_MICROSERVICE_USER_URL,required"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TemplategenMicroserviceURL struct {
|
|
|
|
Templategen string `env:"TEMPLATEGEN_MICROSERVICE_URL,required"`
|
|
|
|
}
|