Package util provides a few bootstrapping utilities for golang services, and a consistent API to wrap third parties libraries for things such as stats aggregation and logging.
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 - if there are known standard configuration paths then you can list them here, 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
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/util.version $(VERSION) \
-X github.com/jeffail/util.dateBuilt $(DATE)"
Returns a flag indicating whether the service should continue or not.
|log||Package log - Some utilities for logging and stats aggregation/pushing.|
|metrics||Package metrics - Create a type for aggregating and propagating metrics to various services based on configuration.|