Move license storage to database

Этот коммит содержится в:
JoramWilander
2016-02-04 13:00:03 -05:00
родитель 7e8389cd05
Коммит e45282deaa
14 изменённых файлов: 284 добавлений и 53 удалений

Просмотреть файл

@@ -69,7 +69,7 @@ func main() {
web.InitWeb()
if model.BuildEnterpriseReady == "true" {
utils.LoadLicense()
loadLicense()
}
if flagRunCmds {
@@ -95,6 +95,26 @@ func main() {
}
}
func loadLicense() {
licenseId := ""
if result := <-api.Srv.Store.System().Get(); result.Err == nil {
props := result.Data.(model.StringMap)
licenseId = props[model.SYSTEM_ACTIVE_LICENSE_ID]
}
if len(licenseId) != 26 {
l4g.Warn(utils.T("mattermost.load_license.find.warn"))
return
}
if result := <-api.Srv.Store.License().Get(licenseId); result.Err == nil {
record := result.Data.(*model.LicenseRecord)
utils.LoadLicense([]byte(record.Bytes))
} else {
l4g.Warn(utils.T("mattermost.load_license.find.warn"))
}
}
func setDiagnosticId() {
if result := <-api.Srv.Store.System().Get(); result.Err == nil {
props := result.Data.(model.StringMap)