fix
This commit is contained in:
+14
-5
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user