From 81886c842c1f3fbd51d5d1ec8d20c7992b9ec777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 15 Jan 2022 22:04:11 +0100 Subject: [PATCH] Change http server to use new config --- go.mod | 2 +- http.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 19d317b..e00123f 100644 --- a/go.mod +++ b/go.mod @@ -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/pelletier/go-toml v1.9.4 // indirect +require github.com/pelletier/go-toml v1.9.4 diff --git a/http.go b/http.go index 8d5de92..c9f1ee1 100644 --- a/http.go +++ b/http.go @@ -10,14 +10,16 @@ import ( ) type HTTPServer struct { - store FileStore + store FileStore + config *ServerConfig http.Server } -func NewHTTPServer(store FileStore) *HTTPServer { +func NewHTTPServer(cfg *ServerConfig) *HTTPServer { srv := &HTTPServer{ - store: store, + config: cfg, } + srv.store = NewMemoryFileStore() r := chi.NewRouter() r.Get("/", srv.HandlerIndex)