|
- <%
- ' ApiHealthController: liveness and readiness probes (spec 9, health). No authentication, no tenant data.
- '
- ' GET /api/v1/health/live Live 200 while the process answers
- ' GET /api/v1/health/ready Ready 200 when the database answers, else 503
- Class ApiHealthController_Class
- Public Property Get useLayout()
- useLayout = False
- End Property
-
- Public Property Let useLayout(v)
- End Property
-
- Public Property Get Title()
- Title = "Health"
- End Property
-
- Public Sub Live()
- Api_Send 200, "{""status"":""live""}"
- End Sub
-
- Public Sub Ready()
- Dim rs, ok
- ok = False
- On Error Resume Next
- Set rs = DAL().Query("SELECT 1", Empty)
- If Err.Number = 0 Then
- ok = Not rs.EOF
- rs.Close
- End If
- Err.Clear
- On Error GoTo 0
- If ok Then
- Api_Send 200, "{""status"":""ready""}"
- Else
- Api_Send 503, "{""status"":""unavailable""}"
- End If
- End Sub
-
- ' Static action dispatch (AxonASP mishandles runtime-built Eval/Execute calls and shared call sites)
- Public Sub Invoke(actionName, args)
- Select Case LCase(actionName)
- Case "live" : Live
- Case "ready" : Ready
- Case Else
- Err.Raise 438, "ApiHealthController_Class", "Action '" & actionName & "' not found"
- End Select
- End Sub
-
- End Class
-
- Dim ApiHealthController_Class__Singleton
- Function ApiHealthController()
- If IsEmpty(ApiHealthController_Class__Singleton) Then
- Set ApiHealthController_Class__Singleton = New ApiHealthController_Class
- End If
- Set ApiHealthController = ApiHealthController_Class__Singleton
- End Function
-
- ' Global entry point used by MVC_InvokeAction via GetRef (one call site per controller)
- Sub ApiHealthController_Invoke(actionName, args)
- ApiHealthController().Invoke actionName, args
- End Sub
- %>
|