коммит произвёл
GitHub
родитель
668a2aa856
Коммит
64d12c08e9
@@ -5,6 +5,7 @@ package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -35,8 +36,8 @@ func (s *Server) LoadLicense() {
|
||||
}
|
||||
}
|
||||
|
||||
record, err := s.Store.License().Get(licenseId)
|
||||
if err != nil {
|
||||
record, nErr := s.Store.License().Get(licenseId)
|
||||
if nErr != nil {
|
||||
mlog.Info("License key from https://mattermost.com required to unlock enterprise features.")
|
||||
s.SetLicense(nil)
|
||||
return
|
||||
@@ -74,10 +75,16 @@ func (s *Server) SaveLicense(licenseBytes []byte) (*model.License, *model.AppErr
|
||||
record.Id = license.Id
|
||||
record.Bytes = string(licenseBytes)
|
||||
|
||||
_, err = s.Store.License().Save(record)
|
||||
if err != nil {
|
||||
_, nErr := s.Store.License().Save(record)
|
||||
if nErr != nil {
|
||||
s.RemoveLicense()
|
||||
return nil, model.NewAppError("addLicense", "api.license.add_license.save.app_error", nil, "err="+err.Error(), http.StatusInternalServerError)
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(nErr, &appErr):
|
||||
return nil, appErr
|
||||
default:
|
||||
return nil, model.NewAppError("addLicense", "api.license.add_license.save.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
sysVar := &model.System{}
|
||||
|
||||
Ссылка в новой задаче
Block a user