diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/cli.go | 18 |
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") +} |
