remove configuration for file reader
Alan Pearce alan@alanpearce.eu
Thu, 30 Jan 2025 15:23:14 +0100
2 files changed, 2 insertions(+), 10 deletions(-)
M cmd/server/main.go → cmd/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.go → internal/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")