/
httphandler.go
35 lines (30 loc) · 1.05 KB
/
httphandler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package handler
import (
"github.com/KaiserWerk/sessionstore/v2"
"github.com/sirupsen/logrus"
"github.com/KaiserWerk/Tiny-Build-Server/internal/buildservice"
"github.com/KaiserWerk/Tiny-Build-Server/internal/configuration"
"github.com/KaiserWerk/Tiny-Build-Server/internal/dbservice"
"github.com/KaiserWerk/Tiny-Build-Server/internal/deploymentservice"
"github.com/KaiserWerk/Tiny-Build-Server/internal/mailer"
"github.com/KaiserWerk/Tiny-Build-Server/internal/templateservice"
)
type HttpHandler struct {
Configuration *configuration.AppConfig
DBService *dbservice.DBService
BuildService *buildservice.BuildService
DeployService *deploymentservice.DeploymentService
SessMgr *sessionstore.SessionManager
Logger *logrus.Entry
Mailer *mailer.Mailer
}
func (h *HttpHandler) ContextLogger(context string) *logrus.Entry {
return h.Logger.WithField("context", context)
}
func (h *HttpHandler) Injector() *templateservice.Injector {
return &templateservice.Injector{
Logger: h.Logger,
SessMgr: h.SessMgr,
Ds: h.DBService,
}
}