about summary refs log tree commit diff stats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/build/main.go10
-rw-r--r--cmd/cspgenerator/cspgenerator.go3
-rw-r--r--cmd/server/main.go4
3 files changed, 11 insertions, 6 deletions
diff --git a/cmd/build/main.go b/cmd/build/main.go
index 14175e9..39cbc1b 100644
--- a/cmd/build/main.go
+++ b/cmd/build/main.go
@@ -5,6 +5,7 @@ import (
 	"os"
 
 	"go.alanpearce.eu/website/internal/builder"
+	"go.alanpearce.eu/website/internal/config"
 	"go.alanpearce.eu/website/internal/log"
 
 	"github.com/ardanlabs/conf/v3"
@@ -20,7 +21,7 @@ func main() {
 		}
 		panic("error parsing configuration: " + err.Error())
 	}
-	log.Configure(!ioConfig.Development)
+	log := log.Configure(!ioConfig.Development)
 
 	log.Debug("starting build process")
 	if ioConfig.Source != "." {
@@ -29,7 +30,12 @@ func main() {
 			log.Panic("could not change to source directory")
 		}
 	}
-	_, err := builder.BuildSite(ioConfig, nil)
+	cfg, err := config.GetConfig(ioConfig.Source, log)
+	if err != nil {
+		log.Error("could not read config", "error", err)
+	}
+
+	_, err = builder.BuildSite(ioConfig, cfg, log)
 	if err != nil {
 		log.Error("could not build site", "error", err)
 		os.Exit(1)
diff --git a/cmd/cspgenerator/cspgenerator.go b/cmd/cspgenerator/cspgenerator.go
index 1b9b9ba..0252d32 100644
--- a/cmd/cspgenerator/cspgenerator.go
+++ b/cmd/cspgenerator/cspgenerator.go
@@ -2,12 +2,11 @@ package main
 
 import (
 	"go.alanpearce.eu/website/internal/config"
-	"go.alanpearce.eu/website/internal/log"
 )
 
 func main() {
 	err := config.GenerateCSP()
 	if err != nil {
-		log.Fatal("error generating csp", "error", err)
+		panic(err)
 	}
 }
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 576cfb3..b74a0cc 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -23,7 +23,7 @@ func main() {
 		}
 		panic("parsing runtime configuration" + err.Error())
 	}
-	log.Configure(!runtimeConfig.Development)
+	log := log.Configure(!runtimeConfig.Development)
 
 	if runtimeConfig.Development {
 		tmpdir, err := os.MkdirTemp("", "website")
@@ -34,7 +34,7 @@ func main() {
 		runtimeConfig.Root = tmpdir
 	}
 
-	sv, err := server.New(&runtimeConfig)
+	sv, err := server.New(&runtimeConfig, log)
 	if err != nil {
 		log.Error("could not create server", "error", err)