all repos — website @ 4566db657dab6af43f8fce814cd0e42cbcc788bf

My website

remove configuration for file reader
Alan Pearce alan@alanpearce.eu
Thu, 30 Jan 2025 15:23:14 +0100
commit

4566db657dab6af43f8fce814cd0e42cbcc788bf

parent

76fef1c17a03bd004571c0ae679bddffb8d58ba0

2 files changed, 2 insertions(+), 10 deletions(-)

jump to
M cmd/server/main.gocmd/server/main.go
@@ -26,13 +26,7 @@ } 	log := log.Configure(!runtimeConfig.Development)
 
 	if runtimeConfig.Development {
-		tmpdir, err := os.MkdirTemp("", "website")
-		if err != nil {
-			log.Fatal("could not create temporary directory", "error", err)
-		}
-		log.Info("using temporary directory", "dir", tmpdir)
-		defer os.RemoveAll(tmpdir)
-		runtimeConfig.Root = tmpdir
+		runtimeConfig.DBPath = ":memory:"
 	}
 
 	sv, err := server.New(&runtimeConfig, log)
M internal/server/server.gointernal/server/server.go
@@ -30,7 +30,6 @@ ) 
 type Config struct {
 	DBPath        string `conf:"default:site.db"`
-	Root          string `conf:"default:public"`
 	Redirect      bool   `conf:"default:true"`
 	ListenAddress string `conf:"default:localhost"`
 	Port          int    `conf:"default:8080,short:p"`
@@ -97,7 +96,6 @@ } 
 func New(runtimeConfig *Config, log *log.Logger) (*Server, error) {
 	builderConfig := &builder.IOConfig{
-		Destination: runtimeConfig.Root,
 		Development: runtimeConfig.Development,
 	}
 
@@ -147,7 +145,7 @@ } 
 	loggingMux := http.NewServeMux()
 
-	log.Debug("registering content files", "root", runtimeConfig.Root)
+	log.Debug("creating reader")
 	reader, err := sqlite.NewReader(runtimeConfig.DBPath, log.Named("sqlite"))
 	if err != nil {
 		return nil, errors.WithMessage(err, "could not create sqlite reader")