about summary refs log tree commit diff stats
path: root/internal/server/server.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-13 19:34:12 +0200
committerAlan Pearce2024-05-13 19:34:12 +0200
commit55efc5bec9703a299de5aac89006ed85600445fc (patch)
tree2e73e77ead7b6ad3820b3622be2b779b369e66ad /internal/server/server.go
parent37deedc9b1da92571548c920721984d545269eb4 (diff)
downloadsearchix-55efc5bec9703a299de5aac89006ed85600445fc.tar.lz
searchix-55efc5bec9703a299de5aac89006ed85600445fc.tar.zst
searchix-55efc5bec9703a299de5aac89006ed85600445fc.zip
refactor(config): simplify configuration
commit 8225dbdb692c99b39dcafe2e5ec6ddc4daf08fb5
Author: Alan Pearce <alan@alanpearce.eu>
Date:   Mon May 13 19:18:26 2024 +0200

    refactor: consolidate configuration to reduce command-line options

commit 5616d4c5a9bc6c0c14f744f812fa6609f859dc34
Author: Alan Pearce <alan@alanpearce.eu>
Date:   Mon May 13 17:41:58 2024 +0200

    refactor: move config file parsing to program entry points
Diffstat (limited to 'internal/server/server.go')
-rw-r--r--internal/server/server.go7
1 files changed, 4 insertions, 3 deletions
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{