customer/internal/models/config.go
2023-05-17 23:27:09 +03:00

42 lines
946 B
Go

package models
import (
"time"
"github.com/golang-jwt/jwt/v5"
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/mongo"
)
type Config struct {
HTTP HTTPConfiguration
Service ServiceConfiguration
Database mongo.Configuration
}
type HTTPConfiguration struct {
Host string `env:"HTTP_HOST,default=localhost"`
Port string `env:"HTTP_PORT,default=8080"`
}
type ServiceConfiguration struct {
AuthMicroservice AuthMicroserviceConfiguration
JWT JWTConfiguration
}
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 AuthMicroServiceURL struct {
User string `env:"AUTH_MICROSERVICE_USER_URL,required"`
}