Пример #1
0
func (cmd *ATCCommand) constructWebHandler(
	logger lager.Logger,
	sqlDB *db.SQLDB,
	authValidator auth.Validator,
	pipelineDBFactory db.PipelineDBFactory,
	engine engine.Engine,
) (http.Handler, error) {
	webWrapper := wrappa.MultiWrappa{
		wrappa.NewWebAuthWrappa(cmd.PubliclyViewable, authValidator),
		wrappa.NewWebMetricsWrappa(logger),
	}

	clientFactory := web.NewClientFactory(
		fmt.Sprintf("http://127.0.0.1:%d", cmd.BindPort),
	)

	return webhandler.NewHandler(
		logger,
		webWrapper,
		sqlDB,
		pipelineDBFactory,
		sqlDB,
		cmd.TemplatesDir.Path(),
		cmd.PublicDir.Path(),
		engine,
		clientFactory,
	)
}
Пример #2
0
func (cmd *ATCCommand) constructWebHandler(
	logger lager.Logger,
	authValidator auth.Validator,
	userContextReader auth.UserContextReader,
	pipelineDBFactory db.PipelineDBFactory,
) (http.Handler, error) {
	webWrapper := wrappa.MultiWrappa{
		wrappa.NewWebAuthWrappa(authValidator, userContextReader),
		wrappa.NewWebMetricsWrappa(logger),
	}

	clientFactory := web.NewClientFactory(
		fmt.Sprintf("http://127.0.0.1:%d", cmd.BindPort),
	)

	return webhandler.NewHandler(
		logger,
		webWrapper,
		clientFactory,
	)
}