only create a tempdir in development mode
Alan Pearce alan@alanpearce.eu
Sat, 29 Jun 2024 10:13:44 +0200
1 files changed, 7 insertions(+), 5 deletions(-)
jump to
M cmd/server/main.go → cmd/server/main.go
@@ -25,12 +25,14 @@ panic("parsing runtime configuration" + err.Error()) } log.Configure(!runtimeConfig.Development) - tmpdir, err := os.MkdirTemp("", "website") - if err != nil { - log.Fatal("could not create temporary directory", "error", err) + if runtimeConfig.Development { + tmpdir, err := os.MkdirTemp("", "website") + if err != nil { + log.Fatal("could not create temporary directory", "error", err) + } + defer os.RemoveAll(tmpdir) + runtimeConfig.Root = tmpdir } - defer os.RemoveAll(tmpdir) - runtimeConfig.Root = tmpdir sv, err := server.New(&runtimeConfig) if err != nil {