Documentation
¶
Overview ¶
Package uboot manages process startup, setting up logging, signal handling, and loading of components through golum and uconfig.
This works well for processes with minimal command line flags, and behavior defined by YAML config (see uconfig) (see golum).
func main() {
_, err := uboot.SimpleBoot()
if err != nil {
ulog.Fatalf(..., err)
}
...
uexit.SimpleSignalHandling()
}
From the command line, it is possible to see what components are supported:
program -show all program -show [component]
To run program:
program -config config.yml -log [stdout|logfile]
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Boot ¶
type Boot struct {
Name string // what program calls itself
InstallD string // where program is installed
ConfigF string // abs path to config file
LogF string // path to log file, or empty/"stdout"
LogSize int64 // size of log file before rotate
LogKeep int // logs to keep around
Config *uconfig.Section // the loaded config
DryRun bool // is this a dry run (config check)?
RedirectF string // file to redirect stderr to
//
// set by build system. examples:
// go build -ldflags '-X /import/path.Version=#{$stamp}-#{REV}'
// go build -ldflags '-X main.Version=#{$stamp}-#{REV}'
//
Version string
}
Control process boot
func (*Boot) Configure ¶
func (this *Boot) Configure( cspec string, beforeStart func(c *uconfig.Section) (err error), ) ( config *uconfig.Section, err error, )
Continue boot process: configure from ConfigF (if avail)
if cspec set, use golum to load the components listed in that section.
if beforeStart set, invoke the function after loading golum components but before starting them.
The following substitutions are automatically added for components: - name - configFile - logDir
invoke after Redirect() or logging initialized