Documentation ¶
Overview ¶
Package service contains utilities for bootstrapping a server such as config, logging and metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version string DateBuilt string )
Service wide build stamps.
Functions ¶
func Bootstrap ¶
Bootstrap bootstraps the configuration loading, parsing and reporting for a service through cmd flags. The argument configPtr should be a pointer to a serializable configuration object with all default values.
configPtr should be a pointer to a config struct, which contains default values and should be populated with a users config values if applicable. For an example look at the stats and logger files.
defaultConfigPaths should contain any known standard configuration paths, if the user neglects to specify a config then bootstrap will iterate these paths and read the first one that exists, if any.
Bootstrap allows a user to do the following: - Print version and build info and exit - Load an optional configuration file (supports JSON, YAML) - Print the config file (supports JSON, YAML) and exit
Configuration files will be parsed according to their extension (.js, .json, .yaml, etc) and will have environment variables substituted in before performing the parse.
NOTE: The user may request a version and build time stamp, in which case Bootstrap will print the values of util.Version and util.DateBuilt. To populate those values you must run go build with the following:
-ldflags "-X github.com/Jeffail/benthos/lib/util/service.Version $(VERSION) \ -X github.com/Jeffail/benthos/lib/util/service.DateBuilt $(DATE)"
Returns a flag indicating whether the service should continue or not.
Types ¶
This section is empty.