No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

65 líneas
1.9KB

  1. <%
  2. ' ApiHealthController: liveness and readiness probes (spec 9, health). No authentication, no tenant data.
  3. '
  4. ' GET /api/v1/health/live Live 200 while the process answers
  5. ' GET /api/v1/health/ready Ready 200 when the database answers, else 503
  6. Class ApiHealthController_Class
  7. Public Property Get useLayout()
  8. useLayout = False
  9. End Property
  10. Public Property Let useLayout(v)
  11. End Property
  12. Public Property Get Title()
  13. Title = "Health"
  14. End Property
  15. Public Sub Live()
  16. Api_Send 200, "{""status"":""live""}"
  17. End Sub
  18. Public Sub Ready()
  19. Dim rs, ok
  20. ok = False
  21. On Error Resume Next
  22. Set rs = DAL().Query("SELECT 1", Empty)
  23. If Err.Number = 0 Then
  24. ok = Not rs.EOF
  25. rs.Close
  26. End If
  27. Err.Clear
  28. On Error GoTo 0
  29. If ok Then
  30. Api_Send 200, "{""status"":""ready""}"
  31. Else
  32. Api_Send 503, "{""status"":""unavailable""}"
  33. End If
  34. End Sub
  35. ' Static action dispatch (AxonASP mishandles runtime-built Eval/Execute calls and shared call sites)
  36. Public Sub Invoke(actionName, args)
  37. Select Case LCase(actionName)
  38. Case "live" : Live
  39. Case "ready" : Ready
  40. Case Else
  41. Err.Raise 438, "ApiHealthController_Class", "Action '" & actionName & "' not found"
  42. End Select
  43. End Sub
  44. End Class
  45. Dim ApiHealthController_Class__Singleton
  46. Function ApiHealthController()
  47. If IsEmpty(ApiHealthController_Class__Singleton) Then
  48. Set ApiHealthController_Class__Singleton = New ApiHealthController_Class
  49. End If
  50. Set ApiHealthController = ApiHealthController_Class__Singleton
  51. End Function
  52. ' Global entry point used by MVC_InvokeAction via GetRef (one call site per controller)
  53. Sub ApiHealthController_Invoke(actionName, args)
  54. ApiHealthController().Invoke actionName, args
  55. End Sub
  56. %>

Powered by TurnKey Linux.