aboutsummaryrefslogtreecommitdiff
path: root/web/cli.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-06 16:40:17 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-06 16:40:17 +0200
commitdb4d2b40895db41ce188549f49a6f277ba95c890 (patch)
tree0f9ff048726f6ec030606041eebe808b462ebe7d /web/cli.go
parent8e0c55230ef59869bda1ca19ca8697b447d57698 (diff)
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.
Diffstat (limited to 'web/cli.go')
-rw-r--r--web/cli.go18
1 files changed, 18 insertions, 0 deletions
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")
+}