about summary refs log tree commit diff stats
path: root/cmd/server
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/server')
-rw-r--r--cmd/server/main.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 464c438..51a9e52 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -28,7 +28,16 @@ func main() {
 		}
 		panic("parsing runtime configuration" + err.Error())
 	}
-	log.Configure(runtimeConfig.Production)
+	log.Configure(!runtimeConfig.Development)
+
+	if runtimeConfig.Development {
+		tmpdir, err := os.MkdirTemp("", "website")
+		if err != nil {
+			log.Fatal("could not create temporary directory to build website: %v", err)
+		}
+		runtimeConfig.Root = tmpdir
+		defer os.RemoveAll(tmpdir)
+	}
 
 	c := make(chan os.Signal, 2)
 	signal.Notify(c, os.Interrupt)
@@ -52,9 +61,7 @@ func main() {
 		defer wg.Done()
 		sErr <- sv.Start()
 	}()
-	if !runtimeConfig.InDevServer {
-		log.Info("server listening", "address", sv.Addr)
-	}
+	log.Info("server listening", "address", sv.Addr)
 
 	err = <-sErr
 	if err != nil {