Change http server to use new config
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Torjus Håkestad 2022-01-15 22:04:11 +01:00
parent affae5941b
commit 81886c842c
2 changed files with 6 additions and 4 deletions

2
go.mod
View File

@ -6,4 +6,4 @@ require github.com/google/uuid v1.3.0
require github.com/go-chi/chi/v5 v5.0.7 require github.com/go-chi/chi/v5 v5.0.7
require github.com/pelletier/go-toml v1.9.4 // indirect require github.com/pelletier/go-toml v1.9.4

View File

@ -10,14 +10,16 @@ import (
) )
type HTTPServer struct { type HTTPServer struct {
store FileStore store FileStore
config *ServerConfig
http.Server http.Server
} }
func NewHTTPServer(store FileStore) *HTTPServer { func NewHTTPServer(cfg *ServerConfig) *HTTPServer {
srv := &HTTPServer{ srv := &HTTPServer{
store: store, config: cfg,
} }
srv.store = NewMemoryFileStore()
r := chi.NewRouter() r := chi.NewRouter()
r.Get("/", srv.HandlerIndex) r.Get("/", srv.HandlerIndex)