Documentation
¶
Index ¶
Constants ¶
const FriendlyServiceName = "Boilerplate Cron/Daemon"
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.crondaemon"
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( fx.Provide( NewLoggerConfig, fxlog.NewLogger, fxerrors.NewHandler, NewDebugConfig, fxdebug.NewServer, fxdebug.NewHealthCollector, fxdebug.NewStatusChecker, ), fx.Provide( daemon.NewRunner, ), fx.Provide( NewService, ), )
Module is the collection of all modules of the application.
Functions ¶
func NewDebugConfig ¶
NewDebugConfig creates a debug config for the debug server constructor.
func NewLoggerConfig ¶
NewLoggerConfig creates a logger config for the logger constructor.
func NewService ¶
func NewService(params ServiceParams) daemon.Daemon
NewService returns a new service instance.
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"` // Run the service in daemon mode instead of just running the job once. Daemon bool `flag:"" default:"false" usage:"Start as daemon instead of single run"` // Schedule of the job when running in daemon mode. DaemonSchedule time.Duration `env:"" split_words:"true"` }
Config holds any kind of configuration that comes from the outside world and is necessary for running the application.