Move some more atomic values under Channels (#18837)

* Move some more atomic values under Channels

The following fields were moved:

```
asymmetricSigningKey atomic.Value
clientConfig         atomic.Value
clientConfigHash     atomic.Value
limitedClientConfig  atomic.Value
```

And also moved the initialization order from NewServer
to Channels.Start to better reflect the order of things.

Removed AsymmetricSigningKey from ConfigService
as it was no longer used.

Removed calling regenerateClientConfig during startup explicitly
because it was anyways called from ensureAsymmetricSigningKey.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=87df1e15-588e-49ff-8bd1-ffa9651b8c82
```release-note
NONE
```

* Fix lint error

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2021-10-26 00:05:11 +05:30
коммит произвёл GitHub
родитель a499d2f378
Коммит 6bc6243131
4 изменённых файлов: 47 добавлений и 57 удалений

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

@@ -4,8 +4,11 @@
package app
import (
"sync/atomic"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/services/imageproxy"
"github.com/pkg/errors"
)
// Channels contains all channels related state.
@@ -14,6 +17,11 @@ type Channels struct {
imageProxy *imageproxy.ImageProxy
asymmetricSigningKey atomic.Value
clientConfig atomic.Value
clientConfigHash atomic.Value
limitedClientConfig atomic.Value
// cached counts that are used during notice condition validation
cachedPostCount int64
cachedUserCount int64
@@ -35,10 +43,13 @@ func NewChannels(s *Server) (*Channels, error) {
}, nil
}
func (c *Channels) Start() error {
func (ch *Channels) Start() error {
if err := ch.ensureAsymmetricSigningKey(); err != nil {
return errors.Wrapf(err, "unable to ensure asymmetric signing key")
}
return nil
}
func (c *Channels) Stop() error {
func (*Channels) Stop() error {
return nil
}