修复watch时重启服务bug(重制configed = false以重新初始化配置)

This commit is contained in:
Star 2025-05-02 09:09:59 +08:00
parent a1f5f72181
commit 38cf9933be

View File

@ -115,6 +115,7 @@ func initConfig(opt *gojs.Obj, logger *log.Logger, vm *goja.Runtime) {
// 身份验证和Session
authAccessToken := len(s.Config.AccessTokens) > 0
s.SetClientKeys(serviceConfig.DeviceKey, serviceConfig.ClientKey, serviceConfig.SessionKey)
fmt.Println(u.BMagenta("=====>>>>> 1"), serviceConfig.SessionKey)
if serviceConfig.SessionKey != "" {
s.SetAuthChecker(func(authLevel int, logger *log.Logger, url *string, args map[string]any, request *s.Request, response *s.Response, options *s.WebServiceOptions) (pass bool, object any) {
var session *Session
@ -287,6 +288,7 @@ func init() {
server = s.AsyncStart()
waitChan = make(chan bool, 1)
server.OnStop(func() {
configed = false
if onStop != nil {
onStop(nil)
}