1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: set html base path from server base path

refactor: services
This commit is contained in:
Ferdinand Mütsch
2020-05-24 17:32:26 +02:00
parent d6e9f0295a
commit c171d31f30
16 changed files with 192 additions and 160 deletions

View File

@ -16,10 +16,10 @@ type HeartbeatHandler struct {
heartbeatSrvc *services.HeartbeatService
}
func NewHeartbeatHandler(config *models.Config, heartbearService *services.HeartbeatService) *HeartbeatHandler {
func NewHeartbeatHandler(heartbeatService *services.HeartbeatService) *HeartbeatHandler {
return &HeartbeatHandler{
config: config,
heartbeatSrvc: heartbearService,
config: models.GetConfig(),
heartbeatSrvc: heartbeatService,
}
}

View File

@ -18,9 +18,9 @@ type IndexHandler struct {
var loginDecoder = schema.NewDecoder()
var signupDecoder = schema.NewDecoder()
func NewIndexHandler(config *models.Config, userService *services.UserService) *IndexHandler {
func NewIndexHandler(userService *services.UserService) *IndexHandler {
return &IndexHandler{
config: config,
config: models.GetConfig(),
userSrvc: userService,
}
}

View File

@ -2,6 +2,7 @@ package routes
import (
"fmt"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/utils"
"html/template"
"io/ioutil"
@ -22,6 +23,9 @@ func loadTemplates() {
"date": utils.FormatDateHuman,
"title": strings.Title,
"capitalize": utils.Capitalize,
"getBasePath": func() string {
return models.GetConfig().BasePath
},
})
templates = make(map[string]*template.Template)

View File

@ -24,10 +24,10 @@ type SummaryHandler struct {
config *models.Config
}
func NewSummaryHandler(config *models.Config, summaryService *services.SummaryService) *SummaryHandler {
func NewSummaryHandler(summaryService *services.SummaryService) *SummaryHandler {
return &SummaryHandler{
cummarySrvc: summaryService,
config: config,
config: models.GetConfig(),
}
}