add debug model

This commit is contained in:
fancl 2025-03-05 13:51:53 +08:00
parent 129a9e768d
commit 77ee2d8712
1 changed files with 14 additions and 0 deletions

View File

@ -258,6 +258,20 @@ func (app *application) preStart() (err error) {
app.Handle("/-/healthy", func(ctx Context) (err error) {
return ctx.Success(app.Healthy())
}, WithHandleDescription("Display application healthy"))
if !app.opts.DisableCommand {
if app.command != nil {
app.command.Handle("/-/debug", "Toggle debug model", func(ctx *cli.Context) (err error) {
var (
bv bool
)
if bv, err = strconv.ParseBool(ctx.Argument(0)); err == nil {
Debug(bv)
}
return ctx.Success(Debug())
})
}
}
}
app.plugins.Range(func(key, value any) bool {
if plugin, ok := value.(Plugin); ok {