From db4d2b40895db41ce188549f49a6f277ba95c890 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 6 Sep 2026 16:40:17 +0200 Subject: Split cli.go into per-domain command files Move each CLI command into its owning package (mountain_pass, ride, web) with dispatch and usage in main.go; remove the cli package. --- web/cli.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 web/cli.go (limited to 'web/cli.go') diff --git a/web/cli.go b/web/cli.go new file mode 100644 index 0000000..f925a95 --- /dev/null +++ b/web/cli.go @@ -0,0 +1,18 @@ +package web + +import ( + "database/sql" + "log/slog" + + "github.com/martinlehoux/biking_home/config" + "github.com/martinlehoux/kagamigo/kcore" +) + +func ServeCmd(db *sql.DB, configPath string, appConfig config.Config, enablePprof bool) { + server := NewServer(db, configPath).WithPprof(enablePprof) + if enablePprof { + slog.Info("pprof enabled", "endpoint", appConfig.Server.PublicURL+"/debug/pprof/") + } + slog.Info("Starting web server", "address", appConfig.Server.PublicURL) + kcore.Expect(server.ListenAndServe(appConfig.Server.Address), "web server stopped") +} -- cgit v1.3