Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { GIN struct { Web string Git string Username string Password string } Port uint16 CookieName string DBPath string }
Config containing all the configuration values for a service.
type Tonic ¶
type Tonic struct {
// contains filtered or unexported fields
}
Tonic represents a full service which contains a web server, a database for jobs and sessions, and a worker pool that runs the jobs.
func NewService ¶
func NewService(webform form.Form, preAction worker.PreAction, postAction worker.PostAction, config Config) (*Tonic, error)
NewService creates a new Tonic with a given form and custom job action.
func (*Tonic) SetLogger ¶
SetLogger sets the logger instance for the tonic service and the included worker queue and web service. If unset the service defines its own logger with the same configuration as the standard Logger and the prefix 'tonic: '.
func (*Tonic) SetPostAction ¶
func (srv *Tonic) SetPostAction(f worker.PostAction)
SetPostAction can be used to set or override the custom post-form submission action for the service.
func (*Tonic) SetPreAction ¶
SetPreAction can be used to set or override the custom pre-form submission action for the service.
func (*Tonic) Stop ¶
func (srv *Tonic) Stop()
Stop the service by gracefully shutting down the web service, stopping the worker pool, and closing the database connection, in that order.
func (*Tonic) WaitForInterrupt ¶
func (srv *Tonic) WaitForInterrupt()
WaitForInterrupt blocks until the service receives an interrupt signal (SIGINT).