From 5a60e898ed8711c8c6187e722812e21c79dcafda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B9=BF?= Date: Wed, 13 Dec 2023 14:36:49 +0800 Subject: [PATCH] part set config --- admin/admin.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/admin.go b/admin/admin.go index a76dc0b..cf53a80 100644 --- a/admin/admin.go +++ b/admin/admin.go @@ -14,6 +14,15 @@ func about(w http.ResponseWriter, r *http.Request) { } func setConfig(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + ctxData := ctx.Value(server.RequestCtxKey("ctxData")).(map[string]interface{}) + data, ok := ctxData["data"] + if !ok { + w.WriteHeader(http.StatusBadRequest) + return + } + t := data.(model.HttpServerConfig) + model.SetServerConfig(&t) }