app

package
v0.0.0-...-e46c3b8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(func(lc fx.Lifecycle) reqlogger.Logger {
		path := env.Get(reqLogPathKey)
		logger := reqlogger.New(logcrtr.Config(path))
		lc.Append(fx.Hook{
			OnStop: miscfx.IgnoreContext(logger.Sync),
		})
		return logger
	}),
	fx.Provide(func(lc fx.Lifecycle) *zap.Logger {
		path := env.Get(appLogPathKey)
		logger := logcrtr.Config(path)
		lc.Append(fx.Hook{
			OnStop: miscfx.IgnoreContext(logger.Sync),
		})
		return logger
	}),
	fx.Provide(validator.New),
	fx.Provide(func(lc fx.Lifecycle, logger reqlogger.Logger) *fiber.App {
		app := fiber.New(fiber.Config{

			ReadTimeout:  5 * time.Second,
			WriteTimeout: 3 * time.Second,
			ErrorHandler: errhandler.Handler(logger),
		})
		lc.Append(fx.Hook{
			OnStart: miscfx.IgnoreContext(func() error {
				go app.Listen(":" + env.Get(portKey))
				return nil
			}),
			OnStop: miscfx.IgnoreContext(app.Shutdown),
		})
		return app
	}),
	fx.Invoke(logger.Register),
	fx.Invoke(data.RegisterValidators),
)

Module bundles fx.Options for the app Fx Module.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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