summaryrefslogtreecommitdiff
path: root/admin.go
diff options
context:
space:
mode:
Diffstat (limited to 'admin.go')
-rw-r--r--admin.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/admin.go b/admin.go
index ba3f060..7799913 100644
--- a/admin.go
+++ b/admin.go
@@ -95,9 +95,9 @@ func StartAdmin(initialConfigJSON []byte) error {
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
///// END PPROF STUFF //////
- for _, m := range GetModules("admin") {
- routes := m.New().([]AdminRoute)
- for _, route := range routes {
+ for _, m := range GetModules("admin.routers") {
+ adminrtr := m.New().(AdminRouter)
+ for _, route := range adminrtr.Routes() {
mux.Handle(route.Pattern, route)
}
}
@@ -146,6 +146,11 @@ func StopAdmin() error {
return nil
}
+// AdminRouter is a type which can return routes for the admin API.
+type AdminRouter interface {
+ Routes() []AdminRoute
+}
+
// AdminRoute represents a route for the admin endpoint.
type AdminRoute struct {
http.Handler