infrastructure

package
v0.53.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClosePostgresConnection

func ClosePostgresConnection()

func CloseRabbitMQConnection added in v0.41.0

func CloseRabbitMQConnection()

func ConnectToRabbitMQ added in v0.41.0

func ConnectToRabbitMQ()

func ErrorHandlerMiddleware

func ErrorHandlerMiddleware() gin.HandlerFunc

func GetMultipartFormBufferFromFile added in v0.41.0

func GetMultipartFormBufferFromFile(file *multipart.File) (*baseMultipartFormBuffer, error)

func GetPostgresConnection

func GetPostgresConnection() *sql.DB

func GetRabbitMQChannel added in v0.41.0

func GetRabbitMQChannel() *amqp.Channel

func GetRabbitMQSubmissionsQueue added in v0.41.0

func GetRabbitMQSubmissionsQueue() *amqp.Queue

func GetValidator

func GetValidator() *validator.Validate

func ParseMicroserviceError added in v0.35.0

func ParseMicroserviceError(resp *http.Response, err error) error

ParseMicroserviceError parses the error returned by the archives microservice

func ParseRFCEDate added in v0.53.3

func ParseRFCEDate(date string) (time.Time, error)

ParseRFCEDate parses a date in RFC3339 format

func ValidateMultipartFileHeader added in v0.37.0

func ValidateMultipartFileHeader(multipartHeader *multipart.FileHeader) error

ValidateMultipartFileHeader validates the multipart archive according to the environment configuration and domain rules

func WithAuthenticationMiddleware added in v0.4.0

func WithAuthenticationMiddleware() gin.HandlerFunc

func WithAuthorizationMiddleware added in v0.4.0

func WithAuthorizationMiddleware(role []string) gin.HandlerFunc

func WithServerSentEventsMiddleware added in v0.42.0

func WithServerSentEventsMiddleware() gin.HandlerFunc

Types

type Claims added in v0.3.0

type Claims struct {
	UUID string `json:"uuid"`
	Role string `json:"role"`
	jwt.RegisteredClaims
}

type EnvironmentSpec added in v0.5.1

type EnvironmentSpec struct {
	// Execution environment
	ExecEnvironment string `split_words:"true" default:"development"`
	IsInProduction  bool   `split_words:"true" default:"false"`

	// Connection strings
	DbConnectionString             string `split_words:"true" default:"postgres://postgres:postgres@localhost:5432/codelabs?sslmode=disable"`
	RabbitMQConnectionString       string `split_words:"true" default:"amqp://rabbitmq:rabbitmq@localhost:5672/"`
	WebClientUrl                   string `split_words:"true" default:"http://localhost:5173"`
	StaticFilesMicroserviceAddress string `split_words:"true" default:"http://localhost:8081"`

	// PgSQL migration files
	DbMigrationsPath string `split_words:"true" default:"file://sql/migrations"`

	// JWT parameters
	JwtSecret          string `split_words:"true" default:"default"`
	JwtExpirationHours int    `split_words:"true" default:"6"`

	// Configuration parameters
	ArchiveMaxSizeKb int64 `split_words:"true" default:"1024"`
}

func GetEnvironment

func GetEnvironment() *EnvironmentSpec

type JwtTokenHandler added in v0.3.0

type JwtTokenHandler struct {
	Secret          string
	ExpirationHours int
}

func GetJwtTokenHandler added in v0.3.0

func GetJwtTokenHandler() *JwtTokenHandler

func (JwtTokenHandler) GenerateToken added in v0.3.0

func (handler JwtTokenHandler) GenerateToken(user entities.User) (string, error)

func (JwtTokenHandler) ValidateToken added in v0.3.0

func (handler JwtTokenHandler) ValidateToken(token string) (dtos.CustomClaimsDTO, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL