|
@@ -110,11 +110,12 @@ func getUsage(w http.ResponseWriter, _ *http.Request) {
|
|
|
// 200: serverConfigResponse
|
|
|
func getStatus(w http.ResponseWriter, r *http.Request) {
|
|
|
type status struct {
|
|
|
- DB bool `json:"db_connected"`
|
|
|
- Broker bool `json:"broker_connected"`
|
|
|
- LicenseError string `json:"license_error"`
|
|
|
- IsPro bool `json:"is_pro"`
|
|
|
- TrialEndDate time.Time `json:"trial_end_date"`
|
|
|
+ DB bool `json:"db_connected"`
|
|
|
+ Broker bool `json:"broker_connected"`
|
|
|
+ LicenseError string `json:"license_error"`
|
|
|
+ IsPro bool `json:"is_pro"`
|
|
|
+ TrialEndDate time.Time `json:"trial_end_date"`
|
|
|
+ IsOnTrialLicense bool `json:"is_on_trial_license"`
|
|
|
}
|
|
|
|
|
|
licenseErr := ""
|
|
@@ -122,15 +123,23 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
|
|
|
licenseErr = servercfg.ErrLicenseValidation.Error()
|
|
|
}
|
|
|
var trialEndDate time.Time
|
|
|
- if servercfg.GetLicenseKey() == "" || servercfg.GetNetmakerTenantID() == "" {
|
|
|
- trialEndDate, _ = logic.GetTrialEndDate()
|
|
|
+ var err error
|
|
|
+ isOnTrial := false
|
|
|
+ if servercfg.IsPro && (servercfg.GetLicenseKey() == "" || servercfg.GetNetmakerTenantID() == "") {
|
|
|
+ trialEndDate, err = logic.GetTrialEndDate()
|
|
|
+ if err != nil {
|
|
|
+ slog.Error("failed to get trial end date", "error", err)
|
|
|
+ } else {
|
|
|
+ isOnTrial = true
|
|
|
+ }
|
|
|
}
|
|
|
currentServerStatus := status{
|
|
|
- DB: database.IsConnected(),
|
|
|
- Broker: mq.IsConnected(),
|
|
|
- LicenseError: licenseErr,
|
|
|
- IsPro: servercfg.IsPro,
|
|
|
- TrialEndDate: trialEndDate,
|
|
|
+ DB: database.IsConnected(),
|
|
|
+ Broker: mq.IsConnected(),
|
|
|
+ LicenseError: licenseErr,
|
|
|
+ IsPro: servercfg.IsPro,
|
|
|
+ TrialEndDate: trialEndDate,
|
|
|
+ IsOnTrialLicense: isOnTrial,
|
|
|
}
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|