修复watch时重启服务bug(重制configed = false以重新初始化配置)
This commit is contained in:
parent
a1f5f72181
commit
72fc1ac3ce
@ -115,6 +115,7 @@ func initConfig(opt *gojs.Obj, logger *log.Logger, vm *goja.Runtime) {
|
|||||||
// 身份验证和Session
|
// 身份验证和Session
|
||||||
authAccessToken := len(s.Config.AccessTokens) > 0
|
authAccessToken := len(s.Config.AccessTokens) > 0
|
||||||
s.SetClientKeys(serviceConfig.DeviceKey, serviceConfig.ClientKey, serviceConfig.SessionKey)
|
s.SetClientKeys(serviceConfig.DeviceKey, serviceConfig.ClientKey, serviceConfig.SessionKey)
|
||||||
|
fmt.Println(u.BMagenta("=====>>>>> 1"), serviceConfig.SessionKey)
|
||||||
if 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) {
|
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
|
var session *Session
|
||||||
@ -287,6 +288,7 @@ func init() {
|
|||||||
server = s.AsyncStart()
|
server = s.AsyncStart()
|
||||||
waitChan = make(chan bool, 1)
|
waitChan = make(chan bool, 1)
|
||||||
server.OnStop(func() {
|
server.OnStop(func() {
|
||||||
|
configed = false
|
||||||
if onStop != nil {
|
if onStop != nil {
|
||||||
onStop(nil)
|
onStop(nil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user