From fdf1148db3c37d1be83ea4d52ac370c5da9593a4 Mon Sep 17 00:00:00 2001 From: RanXom Date: Mon, 13 Jul 2026 18:45:47 +0530 Subject: feat(api): inject thumbnail generator --- internal/api/config.go | 8 ++++++-- internal/api/new.go | 11 +++++++---- internal/api/server.go | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'internal/api') diff --git a/internal/api/config.go b/internal/api/config.go index d82147c..a9a72ae 100644 --- a/internal/api/config.go +++ b/internal/api/config.go @@ -1,10 +1,14 @@ package api -import "github.com/RanXom/galleryd/internal/service" +import ( + "github.com/RanXom/galleryd/internal/service" + "github.com/RanXom/galleryd/internal/thumbnail" +) // Config configures the HTTP server type Config struct { Address string - Gallery service.GalleryService + Gallery service.GalleryService + Thumbnails *thumbnail.Generator } diff --git a/internal/api/new.go b/internal/api/new.go index a7c122b..7066d90 100644 --- a/internal/api/new.go +++ b/internal/api/new.go @@ -11,10 +11,13 @@ func New(config Config) *Server { } srv := &Server{ - config: config, - mux: mux, - http: server, - gallery: config.Gallery, + config: config, + + mux: mux, + http: server, + + gallery: config.Gallery, + thumbnail: config.Thumbnails, } srv.mux.HandleFunc( diff --git a/internal/api/server.go b/internal/api/server.go index c12c5bd..2bec8e2 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/RanXom/galleryd/internal/service" + "github.com/RanXom/galleryd/internal/thumbnail" ) // Server exposes the gallery over HTTP @@ -13,5 +14,6 @@ type Server struct { mux *http.ServeMux http *http.Server - gallery service.GalleryService + gallery service.GalleryService + thumbnail *thumbnail.Generator } -- cgit v1.2.3