This commit is contained in:
root
2026-10-01 22:16:48 +02:00
parent b6d1909d7f
commit 9dfdf79fa7
39 changed files with 4560 additions and 181 deletions
+10 -1
View File
@@ -35,7 +35,16 @@ func main() {
if err := st.Migrate(context.Background()); err != nil {
log.Fatal(err)
}
mux := api.New(st, *cfg)
adminPassword := os.Getenv("HALCYON_ADMIN_PASSWORD")
switch {
case adminPassword == "":
log.Print("admin interface is OFF: set HALCYON_ADMIN_PASSWORD to turn it on at /admin")
case len(adminPassword) < 12:
log.Print("admin interface is on at /admin, but its password is short: use at least 12 characters")
default:
log.Print("admin interface is on at /admin")
}
mux := api.New(st, *cfg, api.WithAdminPassword(adminPassword))
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))