서비스 디테일과 서비스 서머리 분리
This commit is contained in:
@ -106,7 +106,7 @@ func (caller apiCaller) writeAccessableServices(w http.ResponseWriter) {
|
|||||||
w.Write([]byte(","))
|
w.Write([]byte(","))
|
||||||
}
|
}
|
||||||
w.Write([]byte(fmt.Sprintf(`"%s":`, v.ServiceName)))
|
w.Write([]byte(fmt.Sprintf(`"%s":`, v.ServiceName)))
|
||||||
serptr := atomic.LoadPointer(&v.serviceSerialized)
|
serptr := atomic.LoadPointer(&v.serviceSummarySerialized)
|
||||||
w.Write(*(*[]byte)(serptr))
|
w.Write(*(*[]byte)(serptr))
|
||||||
start = false
|
start = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,9 +197,10 @@ type serviceDescription struct {
|
|||||||
updateUserinfo func(info usertokeninfo) (bool, string, string)
|
updateUserinfo func(info usertokeninfo) (bool, string, string)
|
||||||
getProviderInfo func(platform string, uid string) (string, string, error)
|
getProviderInfo func(platform string, uid string) (string, string, error)
|
||||||
|
|
||||||
apiUsers unsafe.Pointer
|
apiUsers unsafe.Pointer
|
||||||
divisionsSerialized unsafe.Pointer
|
divisionsSerialized unsafe.Pointer
|
||||||
serviceSerialized unsafe.Pointer
|
serviceSerialized unsafe.Pointer
|
||||||
|
serviceSummarySerialized unsafe.Pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sh *serviceDescription) readProfile(authtype string, id string, binfo string) (email string, err error) {
|
func (sh *serviceDescription) readProfile(authtype string, id string, binfo string) (email string, err error) {
|
||||||
@ -330,9 +331,12 @@ func (sh *serviceDescription) prepare(mg *Maingate) error {
|
|||||||
mg.apiTokenToService.add(keyid.Hex(), sh.ServiceCode)
|
mg.apiTokenToService.add(keyid.Hex(), sh.ServiceCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
bt, _ := json.Marshal(sh.ServiceDescriptionSummary)
|
bt, _ := json.Marshal(sh)
|
||||||
atomic.StorePointer(&sh.serviceSerialized, unsafe.Pointer(&bt))
|
atomic.StorePointer(&sh.serviceSerialized, unsafe.Pointer(&bt))
|
||||||
|
|
||||||
|
btsum, _ := json.Marshal(sh.ServiceDescriptionSummary)
|
||||||
|
atomic.StorePointer(&sh.serviceSummarySerialized, unsafe.Pointer(&btsum))
|
||||||
|
|
||||||
logger.Println("service is ready :", sh.ServiceName, sh.ServiceCode, sh.UseWhitelist, sh.ApiUsers, string(divmarshaled))
|
logger.Println("service is ready :", sh.ServiceName, sh.ServiceCode, sh.UseWhitelist, sh.ApiUsers, string(divmarshaled))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -286,6 +286,7 @@ func (mg *Maingate) watchServiceCollection(parentctx context.Context, serveMux *
|
|||||||
atomic.SwapPointer(&old.divisionsSerialized, data.Service.divisionsSerialized)
|
atomic.SwapPointer(&old.divisionsSerialized, data.Service.divisionsSerialized)
|
||||||
atomic.SwapPointer(&old.apiUsers, data.Service.apiUsers)
|
atomic.SwapPointer(&old.apiUsers, data.Service.apiUsers)
|
||||||
atomic.SwapPointer(&old.serviceSerialized, data.Service.serviceSerialized)
|
atomic.SwapPointer(&old.serviceSerialized, data.Service.serviceSerialized)
|
||||||
|
atomic.SwapPointer(&old.serviceSummarySerialized, data.Service.serviceSummarySerialized)
|
||||||
|
|
||||||
for _, token := range old.ServerApiTokens {
|
for _, token := range old.ServerApiTokens {
|
||||||
mg.apiTokenToService.remove(token.Hex())
|
mg.apiTokenToService.remove(token.Hex())
|
||||||
|
|||||||
Reference in New Issue
Block a user