application

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRunner

type AppRunner interface {
	// Start this function starts initialized application (must be called after Init)
	Start() (bool, error)
	// Stop function to stop application
	Stop() (bool, error)
	// Init function initializes application components
	Init() (bool, error)
	// GetLogger function that required after app initialized all components to log some additional information about application stop
	GetLogger() *logging.AppLogger
}

AppRunner interface that allows to manipulate application

func CreateAppWithConfigs added in v0.1.4

func CreateAppWithConfigs(configFile string, devMode bool) AppRunner

CreateAppWithConfigs creates but not Init new Application as AppRunner

This function creates new Application and pass configFile to newly created object
* Parameters:
*     - configFile - path to config
*     - devMode - developer mode (for showing some non production info = swagger, ...)
* Returns: new Application as AppRunner

func CreateAppWithData added in v0.1.4

func CreateAppWithData(appConfig *config.AppConfig, serverData *data.ServerData, secretKey []byte, devMode bool) AppRunner

CreateAppWithData creates but not Init new Application as AppRunner

This function creates new Application and pass already decoded json of appConfig and serverData plus secretKey
* Parameters:
*     - appConfig  - decoded config
*     - serverData - decoded server config
*     - secretKey  - secret key that is using for signing JWT
* Returns: new Application as AppRunner

type Application added in v0.1.4

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

func (*Application) GetLogger added in v0.1.4

func (app *Application) GetLogger() *logging.AppLogger

GetLogger function that returns logger from initialized application

Returns logger from application (app.Logger), must be called after Init
* Parameters : no
* Returns: logger

func (*Application) Init added in v0.1.4

func (app *Application) Init() (bool, error)

Init initializes application

This function implements application subsystem init:
*    1. Read config if Application was not Created via CreateAppWithData
*    2. After config was decoded this function implements following initialization
*       2.1 Read secret file for signing JWT
*       2.2 Initializes logger
*       2.3 Initializes Data Provider
*       2.4 Initializes REST API
* Parameters: no
* Return result of init (true if init was successful) and error (nil if init was successful)

func (*Application) Start added in v0.1.4

func (app *Application) Start() (bool, error)

Start function that starts application

This function must be called after Init it starts application web server either on HTTP or HTTPS 9depends on config Schema value)
* Parameters: no
* Return start result (true if Start was successful) and error (nil if start was successful)

func (*Application) Stop added in v0.1.4

func (app *Application) Stop() (bool, error)

Stop function that stops application

Now doesn't do anything, just a stub
* Parameters : no
* Returns result of app stop and error

Jump to

Keyboard shortcuts

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