Skip to content

Commit 386edb1

Browse files
authored
feat(api): maintenance allow worker and service calls (#6163)
1 parent fce521f commit 386edb1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

engine/api/router_middleware.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import (
99
)
1010

1111
func (api *API) maintenanceMiddleware(ctx context.Context, w http.ResponseWriter, req *http.Request, rc *service.HandlerConfig) (context.Context, error) {
12-
if !isMaintainer(ctx) && api.Maintenance && !rc.MaintenanceAware && rc.Method != http.MethodGet {
13-
return ctx, sdk.WrapError(sdk.ErrServiceUnavailable, "CDS Maintenance ON")
12+
if api.Maintenance && !rc.MaintenanceAware && rc.Method != http.MethodGet {
13+
isAllowed := isMaintainer(ctx) || isService(ctx) || isWorker(ctx)
14+
if !isAllowed {
15+
return ctx, sdk.WrapError(sdk.ErrServiceUnavailable, "CDS Maintenance ON")
16+
}
1417
}
1518
return ctx, nil
1619
}

0 commit comments

Comments
 (0)