shiori/internal/webserver/server.go

33 lines
784 B
Go
Raw Normal View History

2019-05-21 11:31:40 +08:00
package webserver
2019-05-27 18:01:53 +08:00
import (
"time"
"github.com/go-shiori/shiori/internal/config"
2019-05-27 18:01:53 +08:00
"github.com/go-shiori/shiori/internal/database"
cch "github.com/patrickmn/go-cache"
)
2019-10-07 14:38:40 +08:00
// Config is parameter that used for starting web server
type Config struct {
DB database.DB
DataDir string
ServerAddress string
ServerPort int
RootPath string
Log bool
2019-10-07 14:38:40 +08:00
}
func GetLegacyHandler(cfg Config, dependencies *config.Dependencies) *Handler {
return &Handler{
2019-10-07 14:38:40 +08:00
DB: cfg.DB,
DataDir: cfg.DataDir,
2019-05-27 18:01:53 +08:00
UserCache: cch.New(time.Hour, 10*time.Minute),
SessionCache: cch.New(time.Hour, 10*time.Minute),
2019-08-05 19:26:37 +08:00
ArchiveCache: cch.New(time.Minute, 5*time.Minute),
2019-10-07 14:38:40 +08:00
RootPath: cfg.RootPath,
Log: cfg.Log,
depenencies: dependencies,
2019-05-27 18:01:53 +08:00
}
}