app

package
v0.0.0-...-34ba797 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2015 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package app contains the main Application struct. This struct represents the application and is resposible for creating and connecting all other parts of the software.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupEnv

func CleanupEnv(cfg *config.Config) error

CleanupEnv has to be called on application shutdown. Will remove the pidfile.

func SetupEnv

func SetupEnv(cfg *config.Config) error

SetupEnv will create pidfile and possibly change the workdir.

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application is the type which represents the webserver. It is responsible for parsing the config and it has Start, Stop, Reload and Wait functions.

func New

func New(cfg *config.Config) (*Application, error)

New creates and returns a new Application with the specified config.

func (*Application) Reload

func (a *Application) Reload(cfg *config.Config) error

Reload takse a new configuration and replaces the old one with it. After succesful reload the things that are written in the new config will be in use.

func (*Application) ServeHTTP

func (app *Application) ServeHTTP(writer http.ResponseWriter, req *http.Request)

func (*Application) Start

func (a *Application) Start() error

Start fires up the application.

func (*Application) Stop

func (a *Application) Stop() error

Stop makes sure the application is completely stopped and all of its goroutines and channels are finished and closed.

func (*Application) Wait

func (a *Application) Wait() error

Wait subscribes iteself to few signals and waits for any of them to be received. When Wait returns it is the end of the application.

Jump to

Keyboard shortcuts

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