This commit is contained in:
root
2026-09-20 14:16:41 +02:00
parent 0798933b05
commit b6d1909d7f
56 changed files with 3752 additions and 1989 deletions
+14 -5
View File
@@ -6,16 +6,18 @@ import (
"flag"
"log"
"net/http"
"os"
"wh/api"
"wh/config"
"wh/store"
"wh/web"
"halcyon/api"
"halcyon/config"
"halcyon/store"
"halcyon/web"
)
func main() {
dsn := flag.String("db", config.DatabaseURL(), "sqlite:<path> or postgres:// URL (default: $DATABASE_URL)")
addr := flag.String("addr", ":8080", "listen address")
manual := flag.String("manual-pdf", envOr("MANUAL_PDF", "docs/generated/manual.pdf"), "rendered PDF manual to serve (default: $MANUAL_PDF)")
cfg, err := config.Bind(flag.CommandLine)
if err != nil {
log.Fatal(err)
@@ -34,7 +36,14 @@ func main() {
log.Fatal(err)
}
mux := api.New(st, *cfg)
mux.Handle("/", web.Handler()) // the site; API routes are more specific and win
mux.Handle("/", web.Handler(*manual)) // the site; API routes are more specific and win
log.Printf("listening on %s", *addr)
log.Fatal(http.ListenAndServe(*addr, mux))
}
func envOr(key, def string) string {
if v := os.Getenv(key); v != "" {
return v
}
return def
}