mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-30 06:12:01 +08:00

* feat: added license manager and feature flags * feat: completed org domain api * chore: checking in saml auth handler code * feat: added signup with sso * feat: added login support for admins * feat: added pem support for certificate * ci(build-workflow): 👷 include EE query-service * fix: 🐛 update package name * chore(ee): 🔧 LD_FLAGS related changes Signed-off-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: Prashant Shahi <prashant@signoz.io> Co-authored-by: nityanandagohain <nityanandagohain@gmail.com>
41 lines
849 B
Go
41 lines
849 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
"go.signoz.io/signoz/ee/query-service/model"
|
|
"net/http"
|
|
)
|
|
|
|
func (ah *APIHandler) listLicenses(w http.ResponseWriter, r *http.Request) {
|
|
licenses, apiError := ah.LM().GetLicenses(context.Background())
|
|
if apiError != nil {
|
|
RespondError(w, apiError, nil)
|
|
}
|
|
ah.Respond(w, licenses)
|
|
}
|
|
|
|
func (ah *APIHandler) applyLicense(w http.ResponseWriter, r *http.Request) {
|
|
ctx := context.Background()
|
|
var l model.License
|
|
|
|
if err := json.NewDecoder(r.Body).Decode(&l); err != nil {
|
|
RespondError(w, model.BadRequest(err), nil)
|
|
return
|
|
}
|
|
|
|
if l.Key == "" {
|
|
RespondError(w, model.BadRequest(fmt.Errorf("license key is required")), nil)
|
|
return
|
|
}
|
|
|
|
license, apiError := ah.LM().Activate(ctx, l.Key)
|
|
if apiError != nil {
|
|
RespondError(w, apiError, nil)
|
|
return
|
|
}
|
|
|
|
ah.Respond(w, license)
|
|
}
|