add basic auth for webapi

This commit is contained in:
ginuerzh
2022-02-12 21:05:39 +08:00
parent fdd67a6086
commit f2d806886a
12 changed files with 197 additions and 86 deletions

View File

@ -18,7 +18,7 @@ type serviceRegistry struct {
m sync.Map
}
func (r *serviceRegistry) Register(name string, svc *service.Service) error {
func (r *serviceRegistry) Register(name string, svc service.Servicer) error {
if name == "" || svc == nil {
return nil
}
@ -38,7 +38,7 @@ func (r *serviceRegistry) IsRegistered(name string) bool {
return ok
}
func (r *serviceRegistry) Get(name string) *service.Service {
func (r *serviceRegistry) Get(name string) service.Servicer {
if name == "" {
return nil
}
@ -46,5 +46,5 @@ func (r *serviceRegistry) Get(name string) *service.Service {
if !ok {
return nil
}
return v.(*service.Service)
return v.(service.Servicer)
}