app

package
v0.0.0-...-492eba3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FriendlyServiceName = "Boilerplate gRPC service"

FriendlyServiceName is the visible name of the service.

View Source
const LogTag = ServiceName

LogTag is usually a static value across all instances of the same application as such it is set here as a constant value.

It represents an identifier which can be used to separate logs from different sources.

Falls back to the ServiceName.

View Source
const ServiceName = "boilerplate.grpc.service"

ServiceName is an identifier-like name used anywhere this app needs to be identified.

It identifies the service itself, the actual instance needs to be identified via environment and other details.

Variables

View Source
var Module = fx.Options(
	fxgrpcapp.Module,

	fx.Provide(
		NewLoggerConfig,
		NewDebugConfig,
	),

	fx.Provide(NewGrpcConfig),

	fx.Provide(fxopentracing.NewTracer),

	grpcfx.Module,
)

Module is the collection of all modules of the application.

Functions

func NewDebugConfig

func NewDebugConfig(config Config) *fxdebug.Config

NewDebugConfig creates a debug config for the debug server constructor.

func NewGrpcConfig

func NewGrpcConfig(config Config, tracer opentracing.Tracer) *fxgrpc.Config

NewGrpcConfig creates a grpc config.

func NewLoggerConfig

func NewLoggerConfig(config Config) (*fxlog.Config, error)

NewLoggerConfig creates a logger config for the logger constructor.

Types

type Config

type Config struct {
	// Meaningful values are recommended (eg. production, development, staging, release/123, etc)
	//
	// "development" is treated special: address types will use the loopback interface as default when none is defined.
	// This is useful when developing locally and listening on all interfaces requires elevated rights.
	Environment string `env:"" default:"production"`

	// Turns on some debug functionality: more verbose logs, exposed pprof, expvar and net trace in the debug server.
	Debug bool `env:""`

	// Defines the log format.
	// Valid values are: json, logfmt
	LogFormat string `env:"" split_words:"true" default:"json"`

	// Debug and health check server address
	DebugAddr string `flag:"" split_words:"true" default:":10000" usage:"Debug and health check server address"`

	// Timeout for graceful shutdown
	ShutdownTimeout time.Duration `flag:"" split_words:"true" default:"15s" usage:"Timeout for graceful shutdown"`

	// gRPC server address
	GrpcAddr string `flag:"" split_words:"true" default:":8000" usage:"gRPC service address"`

	// Enable the gRPC reflection service.
	GrpcEnableReflection bool `env:"" split_words:"true"`
}

Config holds any kind of configuration that comes from the outside world and is necessary for running the application.

type Runner

type Runner = fxgrpcapp.Runner

Jump to

Keyboard shortcuts

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