brick

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 31 Imported by: 4

README

brick

Build Status Coverage Status GoDevDoc Time Tracker Code lines Comments

Brick is a minimalistic opinionated web service unit suitable for microservice development.

WORK IN PROGRESS

Documentation

Overview

Package brick contains facades and configurations that are useful for a variety of apps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugHandler

func DebugHandler(l *BaseLocator, options ...func(options *debug.RouterConfig)) *chi.Mux

DebugHandler provides developer tools via http.

func MountDevPortal

func MountDevPortal(r chi.Router, l *BaseLocator, options ...func(options *debug.RouterConfig))

MountDevPortal mounts debug handlers to router.

func NewBaseRouter

func NewBaseRouter(l *BaseLocator) chi.Router

NewBaseRouter initializes default http router.

Types

type BaseConfig

type BaseConfig struct {
	Log zapctxd.Config

	// Environment is the name of environment where application runs.
	Environment string `default:"dev"`

	// ServiceName is the name of the service to use in documentation and tracing.
	ServiceName string `split_words:"true"`

	// ShutdownTimeout limits time for graceful shutdown of an application.
	ShutdownTimeout time.Duration `default:"10s" split_words:"true"`

	// Debug controls dev tools.
	Debug debug.Config `split_words:"true"`
}

BaseConfig is a basic application agnostic service configuration that manages common infrastructure.

type BaseLocator

type BaseLocator struct {
	BaseConfig BaseConfig

	ctxd.LoggerProvider
	stats.TrackerProvider
	*graceful.Switch

	UseCaseMiddlewares []usecase.Middleware

	OpenAPI               *openapi.Collector
	HTTPRequestDecoder    *request.DecoderFactory
	HTTPServerMiddlewares []func(h http.Handler) http.Handler
}

BaseLocator is a basic application agnostic service locator that manages common infrastructure.

func NewBaseLocator

func NewBaseLocator(cfg BaseConfig) (*BaseLocator, error)

NewBaseLocator initializes basic service locator.

func NoOpLocator

func NoOpLocator() *BaseLocator

NoOpLocator creates a dummy service locator, suitable to docs rendering.

Directories

Path Synopsis
Package config provides configuration loader based on env vars.
Package config provides configuration loader based on env vars.
Package debug provides debug helpers.
Package debug provides debug helpers.
zpages
Package zpages provides OpenCensus zpages handlers.
Package zpages provides OpenCensus zpages handlers.
Package graceful orchestrates shutdown gracefully.
Package graceful orchestrates shutdown gracefully.
Package jaeger configures OpenCensus Jaeger exporter.
Package jaeger configures OpenCensus Jaeger exporter.
Package log provides logging instrumentation.
Package log provides logging instrumentation.
Package opencensus provides helpers for OpenCensus instrumentation.
Package opencensus provides helpers for OpenCensus instrumentation.
Package runtime provides observability helpers.
Package runtime provides observability helpers.
Package usecase provides usecase instrumentation.
Package usecase provides usecase instrumentation.

Jump to

Keyboard shortcuts

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