feat(surf): print the serve URL and admin status on startup
- Add surf.Router.AdminPrefix (additive): the admin mount path and true when BuildRouter mounted the cabana admin, false otherwise - serve binds with net.Listen before printing, so a busy port fails without a misleading URL, then prints the listen address with a browser URL and an admin status line: the admin URL, a warning naming summer admin:create when backend_users is empty or missing, or admin: off with the steps to add an admin controller - The administrator count is bounded by a 2 s timeout and never fails boot - route:list ends with the same admin status line - surf and cabana READMEs and the console and routing docs describe the output
This commit is contained in:
@@ -60,6 +60,8 @@ type Router struct {
|
||||
uploadBytes int64
|
||||
built map[string]pact.Middleware
|
||||
app *backpack.App
|
||||
adminPrefix string
|
||||
adminMounted bool
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -556,6 +558,8 @@ func BuildRouter(app *backpack.App, plugins []party.Plugin) (*Router, error) {
|
||||
if err := r.checkAdminPrefix(admin.Prefix); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.adminPrefix = admin.Prefix
|
||||
r.adminMounted = true
|
||||
}
|
||||
for _, rt := range r.routes {
|
||||
if _, err := r.wrap(rt); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user