envelopemw

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package envelopemw implements Gin-Gonic middleware to be used as a way to guarantee the response normalization throw the envelope defined structure.

Index

Constants

View Source
const (
	// EnvID defines the slate.api.rest.envelopemw package base environment
	// variable name.
	EnvID = rest.EnvID + "_ENVELOPE"
)
View Source
const (
	// ID defines the default id used to register
	// the application envelope middleware and related services.
	ID = rest.ID + ".envelope"
)

Variables

View Source
var (
	// ServiceIDConfigPath defines the config path that used to store the
	// application service identifier.
	ServiceIDConfigPath = env.String(EnvID+"_SERVICE_ID_CONFIG_PATH", "slate.api.rest.service.id")

	// FormatAcceptListConfigPath defines the config path that used toLogAcceptListErrorMessage
	// store the application accepted mime types formats.
	FormatAcceptListConfigPath = env.String(EnvID+"_FORMAT_ACCEPT_LIST_CONFIG_PATH", "slate.api.rest.accept")

	// EndpointIDConfigPathFormat defines the format of the configuration
	// path where the endpoint identification number can be retrieved.
	EndpointIDConfigPathFormat = env.String(EnvID+"_ENDPOINT_ID_CONFIG_PATH_FORMAT", "slate.api.rest.endpoints.%s.id")

	// LogLevel @todo doc
	LogLevel = env.String(EnvID+"_LOG_LEVEL", "error")

	// LogChannel @todo doc
	LogChannel = env.String(EnvID+"_LOG_CHANNEL", "rest")

	// LogServiceErrorMessage @todo doc
	LogServiceErrorMessage = env.String(EnvID+"_LOG_SERVICE_ERROR_MESSAGE", "Invalid service id")

	// LogAcceptListErrorMessage @todo doc
	LogAcceptListErrorMessage = env.String(EnvID+"_LOG_ACCEPT_LIST_ERROR_MESSAGE", "Invalid accept list")

	// LogEndpointErrorMessage @todo doc
	LogEndpointErrorMessage = env.String(EnvID+"_LOG_ENDPOINT_ERROR_MESSAGE", "Invalid endpoint id")
)

Functions

This section is empty.

Types

type MiddlewareGenerator

type MiddlewareGenerator func(string) (rest.Middleware, error)

MiddlewareGenerator @todo doc

func NewMiddlewareGenerator

func NewMiddlewareGenerator(
	cfg config.IManager,
	logger log.ILog,
) (MiddlewareGenerator, error)

NewMiddlewareGenerator returns a middleware generator function based on the application configuration. This middleware generator function should be called with the corresponding endpoint name, so it can generate the appropriate middleware function.

type Provider

type Provider struct{}

Provider defines the default envelope provider to be used on the application initialization to register the file system adapter service.

func (Provider) Boot

func (Provider) Boot(
	container ...slate.IContainer,
) error

Boot (no-op).

func (Provider) Register

func (p Provider) Register(
	container ...slate.IContainer,
) error

Register will add to the container a new file system adapter instance.

Jump to

Keyboard shortcuts

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