app

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TerminationSignalWatcher

func TerminationSignalWatcher(srv *http.Server)

TerminationSignalWatcher will wait for interrupt signal to gracefully shutdown the server with a timeout of x seconds.

Types

type ApplicationConfig

type ApplicationConfig struct {
	ApplicationMode    string
	DatabaseConnection string
	WebAssetLocation   string
}

ApplicationConfig represents the necessary configuration for the application.

func GetConfig

func GetConfig() *ApplicationConfig

GetConfig will return a populated ApplicationConfig object from variables in the OS environment.

type ApplicationServer

type ApplicationServer struct {
	State ApplicationState
}

ApplicationServer is the core application's handler, the contact surface with outside world.

func NewApplicationServer

func NewApplicationServer(userOptions *ApplicationState) *ApplicationServer

NewApplicationServer will return a fully configured ApplicationServer.

type ApplicationServerResponse

type ApplicationServerResponse struct {
	Message       string `json:"message,omitempty"`
	Error         string `json:"error,omitempty"`
	UnixTimestamp int64  `json:"unix_timestamp"`
}

ApplicationServerResponse is the standard response the server returns when using JSON.

type ApplicationState

type ApplicationState struct {
	Handler    infrastructure.ApplicationHTTPHandler
	HTTPServer *http.Server
	DB         infrastructure.ApplicationDatabase
	Config     *ApplicationConfig
}

ApplicationState is the application's state in a centralized manner.

Jump to

Keyboard shortcuts

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