service

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package service contains utilities for bootstrapping a server such as config, logging and metrics.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string
	DateBuilt string
)

Service wide build stamps.

Functions

func Bootstrap

func Bootstrap(configPtr interface{}, defaultConfigPaths ...string) bool

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.

Directories

Path Synopsis
Package config contains utilities for reading and parsing service configuration files.
Package config contains utilities for reading and parsing service configuration files.
Package log contains utilities for logging in a modular interface.
Package log contains utilities for logging in a modular interface.
Package metrics contains a type for aggregating and propagating metrics to various services based on configuration.
Package metrics contains a type for aggregating and propagating metrics to various services based on configuration.

Jump to

Keyboard shortcuts

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