Skip to content

Commit c72c813

Browse files
authored
fix(api): return public status with maintenance flag (#5799)
1 parent 368caaf commit c72c813

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

engine/api/status.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func (api *API) statusHandler() service.Handler {
5757
// If there is a valid session and user is maintainer, allows to get status details.
5858
currentConsumer := getAPIConsumer(ctx)
5959
if currentConsumer == nil || !isMaintainer(ctx) {
60-
return service.WriteJSON(w, nil, status)
60+
mStatus := api.computeGlobalPublicStatus()
61+
return service.WriteJSON(w, mStatus, status)
6162
}
6263

6364
mStatus := api.computeGlobalStatus(srvs)
@@ -80,6 +81,19 @@ var (
8081
tagsService []tag.Key
8182
)
8283

84+
// computeGlobalPublicStatus returns global public status
85+
func (api *API) computeGlobalPublicStatus() sdk.MonitoringStatus {
86+
return sdk.MonitoringStatus{
87+
Lines: []sdk.MonitoringStatusLine{
88+
{
89+
Status: sdk.MonitoringStatusOK,
90+
Component: "Global/Maintenance",
91+
Value: fmt.Sprintf("%v", api.Maintenance),
92+
},
93+
},
94+
}
95+
}
96+
8397
// computeGlobalStatus returns global status
8498
func (api *API) computeGlobalStatus(srvs []sdk.Service) sdk.MonitoringStatus {
8599
mStatus := sdk.MonitoringStatus{}

0 commit comments

Comments
 (0)