From 3fac7d79ab317081961a7ec64eea26e8b3c6d778 Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Wed, 13 May 2020 13:42:56 +0100 Subject: [PATCH] Remove service type role --- service.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/service.go b/service.go index c1458810..17b614d1 100644 --- a/service.go +++ b/service.go @@ -233,21 +233,11 @@ func (s *service) Run() error { } func (s *service) registerAuthAccount() error { - // determine the type of service from the name. we do this so we can allocate - // different roles depending on the type of services. e.g. we don't want web - // services talking directly to the runtime. TODO: find a better way to determine - // the type of service - serviceType := "service" - if strings.Contains(s.Name(), "api") { - serviceType = "api" - } else if strings.Contains(s.Name(), "web") { - serviceType = "web" - } - // generate a new auth account for the service name := fmt.Sprintf("%v-%v", s.Name(), s.Server().Options().Id) opts := []auth.GenerateOption{ - auth.WithRoles(serviceType), + auth.WithType("service"), + auth.WithRoles("service"), auth.WithNamespace(s.Options().Auth.Options().Namespace), } acc, err := s.Options().Auth.Generate(name, opts...)