Add init function.

This commit is contained in:
Daniel Theophanes
2013-03-02 22:31:55 -08:00
parent 84037bf6d2
commit 83aba983e4
+9
View File
@@ -16,6 +16,10 @@ type Config struct {
// Stop() may be nil.
Start, Stop func()
// Called after logging may be setup but before the service is started.
// Init() is optional and may be nil.
Init func()
s service.Service
l service.Logger
}
@@ -86,6 +90,11 @@ func Run(c *Config) {
}
return
}
if c.Init != nil {
c.Init()
}
err = s.Run(func() error {
// start
go c.Start()