MSP-7042 Ref routes.Routes

This commit is contained in:
Синельник Тимур Романович committed 2026-01-23 13:42:41 +03:00
1 parent 29cdf42808
commit 2ddb3a3d1f
19 files changed
+193 -102

No files matched your search

+1 -1
View File
@@ -74,7 +74,7 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
boot: boot,
server: server,
logger: boot.App.Logger(),
routes: routes.NewRoutes(),
routes: routes.NewRoutes(boot.App.Logger()),
locations: localConfig.Locations,
grpcClientByModuleName: grpcClientByModuleName,
httpHostManagerByModuleName: httpHostManagerByModuleName,
+11 -5
View File
@@ -1,11 +1,12 @@
package assembly
import (
"github.com/txix-open/isp-kit/metrics"
"github.com/txix-open/isp-kit/metrics/http_metrics"
"net/http"
"time"
"github.com/txix-open/isp-kit/metrics"
"github.com/txix-open/isp-kit/metrics/http_metrics"
"isp-gate-service/conf"
"isp-gate-service/middleware"
"isp-gate-service/proxy"
@@ -110,13 +111,16 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
middleware.Authenticate(authentication),
middleware.AdminAuthenticate(adminService),
middleware.Authorize(authorization, l.logger),
middleware.AdminAuthorize(l.routes, adminService),
middleware.AdminAuthorize(adminService),
middleware.Throttling(throttlingService),
middleware.DailyLimit(dailyLimitService),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Metrics(metricsStorage),
)
errorOnUnknownEndpoint := true
if location.SkipAuth {
errorOnUnknownEndpoint = false
handler = middleware.Chain(
proxyFunc,
middleware.Logger(l.logger, config.Logging.RequestLogEnable,
@@ -133,8 +137,10 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
handler,
middleware.EntryPointConfig{
WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix,
WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix,
ErrorOnUnknownEndpoint: errorOnUnknownEndpoint,
WithLendingSlash: location.Protocol != conf.GrpcProtocol,
},
l.routes,
l.logger,