customer/internal/models/config.go

42 lines
946 B
Go
Raw Normal View History

2023-05-16 01:12:07 +00:00
package models
import (
"time"
"github.com/golang-jwt/jwt/v5"
2023-05-16 04:01:55 +00:00
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/mongo"
2023-05-16 01:12:07 +00:00
)
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 {
2023-05-17 20:27:09 +00:00
URL AuthMicroServiceURL
2023-05-16 01:12:07 +00:00
}
type AuthMicroServiceURL struct {
2023-05-17 20:27:09 +00:00
User string `env:"AUTH_MICROSERVICE_USER_URL,required"`
2023-05-16 01:12:07 +00:00
}