app

package
v0.0.0-...-5fdec1d Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(logger *zap.Logger, cfg interface{})

LoadConfig loads configuration from envs and prints usage if requirements are not fulfilled

Types

type App

type App struct {
	Logger *zap.Logger
	Router chi.Router
	// contains filtered or unexported fields
}

App is responsible for initializing and running application

func NewApp

func NewApp(logger *zap.Logger, cfg Config) *App

NewApp initializes application

func (App) AddCleanup

func (ch App) AddCleanup(cleanup func())

AddCleanup adds cleanup to cleanup list which is run before application closes

func (App) AddErrCleanup

func (ch App) AddErrCleanup(cleanup func() error)

AddErrCleanup adds cleanup which returns an error to cleanup list which is run before application closes

func (*App) Build

func (a *App) Build(initializer func() error)

Build is used to initialize application's dependencies

func (*App) Run

func (a *App) Run()

Run runs application server and other services

type Config

type Config struct {
	HTTPHostAddress         string `default:"0.0.0.0:80" split_words:"true"`
	LogErrorsWithStacktrace bool   `default:"false" split_words:"true"`
}

Config is used to configure application

Jump to

Keyboard shortcuts

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