From 97045512306ed91b690a0d4c20bbb8fe84d7dbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Fri, 3 Oct 2025 20:47:55 +0200 Subject: feat(backend): set default image and public folder in config --- main.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 47a9e22..dc955bc 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,6 @@ var embeds embed.FS var ( configFile = "config.toml" port = 8000 - publicDir = "public" dev = false ) @@ -45,11 +44,6 @@ func init() { } } flag.IntVar(&port, "port", port, "server port") - - if v := os.Getenv("PUBLIC_DIR"); v != "" { - publicDir = v - } - flag.StringVar(&publicDir, "public", publicDir, "public directory") flag.BoolVar(&dev, "dev", false, "development mode") } @@ -81,7 +75,7 @@ func main() { } else { backend.HandleStaticFiles(r, "/assets", backend.UsableEmbedFS("dist", embeds)) } - backend.HandleStaticFiles(r, "/static", os.DirFS(publicDir)) + backend.HandleStaticFiles(r, "/static", os.DirFS(cfg.PublicFolder)) slog.Info("starting http server") server := &http.Server{Addr: fmt.Sprintf(":%d", port), Handler: r} -- cgit v1.2.3