2022-10-08 23:23:30 +13:00
|
|
|
package apiv1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
|
2024-01-02 13:23:16 +13:00
|
|
|
"github.com/axllent/mailpit/internal/stats"
|
2022-10-08 23:23:30 +13:00
|
|
|
)
|
|
|
|
|
|
|
|
// AppInfo returns some basic details about the running app, and latest release.
|
2023-10-28 17:33:11 +13:00
|
|
|
func AppInfo(w http.ResponseWriter, _ *http.Request) {
|
2023-03-31 17:29:04 +13:00
|
|
|
// swagger:route GET /api/v1/info application AppInformation
|
|
|
|
//
|
2023-04-21 11:55:32 +12:00
|
|
|
// # Get application information
|
2023-03-31 17:29:04 +13:00
|
|
|
//
|
|
|
|
// Returns basic runtime information, message totals and latest release version.
|
|
|
|
//
|
|
|
|
// Produces:
|
2023-04-21 11:55:32 +12:00
|
|
|
// - application/json
|
2023-03-31 17:29:04 +13:00
|
|
|
//
|
|
|
|
// Schemes: http, https
|
|
|
|
//
|
|
|
|
// Responses:
|
|
|
|
// 200: InfoResponse
|
|
|
|
// default: ErrorResponse
|
2022-10-08 23:23:30 +13:00
|
|
|
|
|
|
|
w.Header().Add("Content-Type", "application/json")
|
2024-05-05 12:25:26 +12:00
|
|
|
if err := json.NewEncoder(w).Encode(stats.Load()); err != nil {
|
|
|
|
httpError(w, err.Error())
|
|
|
|
}
|
2022-10-08 23:23:30 +13:00
|
|
|
}
|