MM-11384: Add system install date information to the client config (#9218)
* MM-11384: Add system install date information to the client config * Fixing translation text * Fixes from Peer Review
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
3b640cd51b
Коммит
6bf09e2c34
18
app/app.go
18
app/app.go
@@ -11,6 +11,7 @@ import (
|
||||
"net/http"
|
||||
"path"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -212,6 +213,10 @@ func New(options ...Option) (outApp *App, outErr error) {
|
||||
return nil, errors.Wrapf(err, "unable to ensure asymmetric signing key")
|
||||
}
|
||||
|
||||
if err := app.ensureInstallationDate(); err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to ensure installation date")
|
||||
}
|
||||
|
||||
app.EnsureDiagnosticId()
|
||||
app.regenerateClientConfig()
|
||||
|
||||
@@ -740,3 +745,16 @@ func (a *App) StartElasticsearch() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) getSystemInstallDate() (int64, *model.AppError) {
|
||||
result := <-a.Srv.Store.System().GetByName(model.SYSTEM_INSTALLATION_DATE_KEY)
|
||||
if result.Err != nil {
|
||||
return 0, result.Err
|
||||
}
|
||||
systemData := result.Data.(*model.System)
|
||||
value, err := strconv.ParseInt(systemData.Value, 10, 64)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("getSystemInstallDate", "app.system_install_date.parse_int.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return value, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user