app

package
v0.0.0-...-f1bdcb5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "unknown"
	Commit  = "unknown"
	Created = "unknown"
)

Functions

func NewLogger

func NewLogger(level string, format string) (logger *zap.Logger, err error)

func WaitExit

func WaitExit() chan os.Signal

WaitExit waits while user don't press Ctrl+C

Types

type Application

type Application struct {
	// region System
	Config    *Config
	Logger    *zap.Logger
	Info      *BuildInfo
	Ctx       context.Context
	CtxCancel context.CancelFunc
	WaitGroup *sync.WaitGroup

	// endregion
	// region Service
	StepConfig *config.Config
	StepGroups *step.Groups
	Executor   *executor.Executor
	// endregion
	// region Web
	Http       *http.ServeMux
	Management *http.ServeMux

	// endregion
	// region Cli
	Status int
	// contains filtered or unexported fields
}

func New

func New() (app *Application, err error)

func (*Application) Close

func (app *Application) Close()

Close all necessary resources

func (*Application) Error

func (app *Application) Error(err error)

Error - register global error, but only once

func (*Application) RunAction

func (app *Application) RunAction() error

Start of action

func (*Application) RunHttp

func (app *Application) RunHttp(handler *http.ServeMux, port int, name string) error

Start HTTP handler

func (*Application) Start

func (app *Application) Start()

Start initialize all long-living processes

func (*Application) Stop

func (app *Application) Stop()

Stop waits for all resources be cosed

type BuildInfo

type BuildInfo struct {
	Version string `json:"version"`
	Created string `json:"created"`
	Commit  string `json:"commit"`
}

func NewBuildInfo

func NewBuildInfo() *BuildInfo

type Config

type Config struct {
	LogLevel   string `env:"HEALTHY_LOG_LEVEL" envDefault:"warn"`
	LogFormat  string `env:"HEALTHY_LOG_FORMAT" envDefault:"json"`
	ConfigFile string `env:"HEALTHY_CONFIG_FILE"`
	ConfigYaml string `env:"HEALTHY_CONFIG_YAML"`

	Port           int `env:"HEALTHY_PORT" envDefault:"80"`
	ManagementPort int `env:"HEALTHY_MANAGEMENT_PORT" envDefault:"3280"`

	CallWeb     bool
	CallVersion bool
	Quiet       bool
	Verbose     bool
	Groups      []string
	Steps       []string
}

func FlagsConfig

func FlagsConfig(cfg *Config) (*Config, error)

func NewConfig

func NewConfig() (cfg *Config, err error)

type IndexContext

type IndexContext struct {
	Name   string
	Front  config.Frontend
	Groups *step.Groups
}

Jump to

Keyboard shortcuts

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