From 55efc5bec9703a299de5aac89006ed85600445fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 May 2024 19:34:12 +0200 Subject: refactor(config): simplify configuration commit 8225dbdb692c99b39dcafe2e5ec6ddc4daf08fb5 Author: Alan Pearce Date: Mon May 13 19:18:26 2024 +0200 refactor: consolidate configuration to reduce command-line options commit 5616d4c5a9bc6c0c14f744f812fa6609f859dc34 Author: Alan Pearce Date: Mon May 13 17:41:58 2024 +0200 refactor: move config file parsing to program entry points --- internal/server/server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/server/server.go') diff --git a/internal/server/server.go b/internal/server/server.go index d13d031..77163d3 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -6,6 +6,7 @@ import ( "log/slog" "net" "net/http" + "searchix/internal/config" "time" "github.com/pkg/errors" @@ -15,12 +16,12 @@ type Server struct { *http.Server } -func New(runtimeConfig *Config) (*Server, error) { - mux, err := NewMux(runtimeConfig) +func New(conf *config.Config, liveReload bool) (*Server, error) { + mux, err := NewMux(conf, liveReload) if err != nil { return nil, err } - listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, runtimeConfig.Port) + listenAddress := net.JoinHostPort(conf.Web.ListenAddress, conf.Web.Port) return &Server{ &http.Server{ -- cgit 1.4.1