fleet/server/service/service_status.go
2021-08-20 12:27:41 -03:00

34 lines
728 B
Go

package service
import (
"context"
"github.com/fleetdm/fleet/v4/server/fleet"
"github.com/pkg/errors"
)
func (svc *Service) StatusResultStore(ctx context.Context) error {
if err := svc.authz.Authorize(ctx, &fleet.AppConfig{}, fleet.ActionRead); err != nil {
return err
}
return svc.resultStore.HealthCheck()
}
func (svc *Service) StatusLiveQuery(ctx context.Context) error {
if err := svc.authz.Authorize(ctx, &fleet.AppConfig{}, fleet.ActionRead); err != nil {
return err
}
cfg, err := svc.ds.AppConfig()
if err != nil {
return errors.Wrap(err, "retrieve app config")
}
if cfg.ServerSettings.LiveQueryDisabled {
return errors.New("disabled by administrator")
}
return svc.StatusResultStore(ctx)
}