From afdde542c81b2645999e8f6b7e84fd939689116b Mon Sep 17 00:00:00 2001 From: carabasdaniel Date: Wed, 2 Aug 2023 19:24:12 +0300 Subject: [PATCH] Add config validation for service types --- pkg/app/authorizer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/app/authorizer.go b/pkg/app/authorizer.go index 58b0e4452..e7a8cf68e 100644 --- a/pkg/app/authorizer.go +++ b/pkg/app/authorizer.go @@ -86,6 +86,13 @@ func (e *Authorizer) ConfigServices() error { if err != nil { return err } + e.Services["edge"] = edgeDir + + for key := range e.Configuration.Services { + if !(contains(edgeDir.AvailableServices(), key) || key == authorizerService) { + return errors.Errorf("unknown service type %s", key) + } + } e.Services = make(map[string]ServiceTypes) @@ -105,7 +112,6 @@ func (e *Authorizer) ConfigServices() error { unary, stream := middlewareList.AsGRPCOptions() opts = append(opts, unary, stream) - e.Services["edge"] = edgeDir if contains(serviceConfig.registeredServices, "authorizer") { topaz, err := NewTopaz(serviceConfig.API, &e.Configuration.Common, opts, e.Logger) if err != nil {