fix empty initial build in dev
Alan Pearce alan@alanpearce.eu
Wed, 26 Jun 2024 18:45:56 +0200
2 files changed, 7 insertions(+), 7 deletions(-)
M cmd/server/main.go → cmd/server/main.go
@@ -25,6 +25,13 @@ 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) + } + defer os.RemoveAll(tmpdir) + runtimeConfig.Root = tmpdir + sv, err := server.New(&runtimeConfig) if err != nil { log.Error("could not create server", "error", err)
M internal/server/server.go → internal/server/server.go
@@ -103,13 +103,6 @@ if err != nil { return nil, err } runtimeConfig.Root = "website" - } else { - tmpdir, err := os.MkdirTemp("", "website") - if err != nil { - return nil, err - } - defer os.RemoveAll(tmpdir) - runtimeConfig.Root = tmpdir } config, err := cfg.GetConfig()