Documentation ¶
Index ¶
Constants ¶
const FriendlyServiceName = "Boilerplate HTTP service"
FriendlyServiceName is the visible name of the service.
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.
const ServiceName = "boilerplate.http.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 ¶
var Module = fx.Options( fxhttpapp.Module, fx.Provide( NewLoggerConfig, NewDebugConfig, ), fxmux.Module, fx.Provide(NewHTTPConfig), fx.Provide(fxopentracing.NewTracer), webfx.Module, fx.Invoke(otmux.InjectTracer), )
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 NewHTTPConfig ¶
func NewHTTPConfig(config Config) *fxhttp.Config
NewHTTPConfig creates a http config.
func NewLoggerConfig ¶
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"` // HTTP server address HTTPAddr string `flag:"http-addr" default:":8000" usage:"HTTP service address"` }
Config holds any kind of configuration that comes from the outside world and is necessary for running the application.