vibes
This commit is contained in:
+10
-1
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user