mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Added GET licensing endpoint implementation (#1168)
* Added missing endpoint implementation
This commit is contained in:
parent
22118dfdac
commit
9359604c13
1 changed files with 17 additions and 1 deletions
|
|
@ -52,6 +52,22 @@ func makeUpdateLicenseEndpoint(svc kolide.Service) endpoint.Endpoint {
|
|||
|
||||
func makeGetLicenseEndpoint(svc kolide.Service) endpoint.Endpoint {
|
||||
return func(ctx context.Context, request interface{}) (interface{}, error) {
|
||||
return nil, nil
|
||||
lic, err := svc.License(ctx)
|
||||
if err != nil {
|
||||
return licenseResponse{Err: err}, nil
|
||||
}
|
||||
claims, err := lic.Claims()
|
||||
if err != nil {
|
||||
return licenseResponse{Err: err}, nil
|
||||
}
|
||||
response := licenseResponse{
|
||||
License: license{
|
||||
Expiry: claims.ExpiresAt,
|
||||
AllowedHosts: claims.HostLimit,
|
||||
Hosts: lic.HostCount,
|
||||
Token: *lic.Token,
|
||||
},
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue