Documentation
¶
Overview ¶
Package admin provides an HTTP management surface for mailbox service operations. Mount Handler at any path prefix in your HTTP mux:
mux.Handle("/admin/", http.StripPrefix("/admin", admin.NewHandler(svc, admin.WithAuthFunc(myAuth))))
Authentication is required: provide WithAuthFunc or WithAllowAll (for trusted environments).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler exposes mailbox service management operations over HTTP.
func NewHandler ¶
NewHandler creates a new Handler for the given service. Returns an error if svc is nil, or if neither WithAuthFunc nor WithAllowAll is provided.
type Option ¶
type Option func(*options)
Option configures a Handler.
func WithAllowAll ¶ added in v0.7.8
func WithAllowAll() Option
WithAllowAll explicitly opts out of authentication for the admin handler. Use this only in trusted environments (e.g., behind a gateway that handles auth, or in tests). In production, prefer WithAuthFunc.
func WithAuthFunc ¶
WithAuthFunc sets an authorization function. Each request is passed to the function before handling; a false return results in a 403 response.
func WithLogger ¶
WithLogger sets a custom logger. Default is slog.Default().