diff options
Diffstat (limited to 'internal/api/handlers.go')
-rw-r--r-- | internal/api/handlers.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 2cc2188..4c4b2ec 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -102,8 +102,8 @@ func InitializeAPI(logs *[LogLength]string, n *int, toLogParser chan string) { // ScheduledMaintenance: 0, // } status.overallStatus = overallStatus{ - Status: StatusDegraded, - Description: "Everything is not great", + Status: StatusOperational, + Description: "Everything is operating normally", Uptime: 50.0, ResponseTime: 20000, ActiveIncidents: 9001, @@ -207,6 +207,19 @@ func InitializeAPI(logs *[LogLength]string, n *int, toLogParser chan string) { addRotLog(logs, n, toLogParser, fmt.Sprintf(`{"incidentEvent": %s}`, string(jsonData))) }) status.overallStatus.ActiveIncidents = len(status.incidents) + + status.overallStatus.Status = StatusOperational + status.overallStatus.Description = "Everything is operating normally" + for _, s := range status.incidents { + if s.Status == StatusDown { + status.overallStatus.Status = StatusDown + break + } + + if s.Status == StatusDegraded { + status.overallStatus.Status = StatusDegraded + } + } } } }() |