tonic

package
v0.0.0-...-65ffb28 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

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) SetForm

func (srv *Tonic) SetForm(webform form.Form)

SetForm can be used to set or override the form for the service.

func (*Tonic) SetLogger

func (srv *Tonic) SetLogger(l *log.Logger)

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

func (srv *Tonic) SetPreAction(f worker.PreAction)

SetPreAction can be used to set or override the custom pre-form submission action for the service.

func (*Tonic) Start

func (srv *Tonic) Start() error

Start the service (worker and web server).

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).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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