Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package testutils
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
)
|
|
|
|
type StaticConfigService struct {
|
|
Cfg *model.Config
|
|
|
|
listeners map[string]func(old, current *model.Config)
|
|
}
|
|
|
|
func (s *StaticConfigService) Config() *model.Config {
|
|
return s.Cfg
|
|
}
|
|
|
|
func (s *StaticConfigService) AddConfigListener(listener func(old, current *model.Config)) string {
|
|
if s.listeners == nil {
|
|
s.listeners = make(map[string]func(old, current *model.Config))
|
|
}
|
|
|
|
listenerID := model.NewId()
|
|
s.listeners[listenerID] = listener
|
|
return listenerID
|
|
}
|
|
|
|
func (s *StaticConfigService) RemoveConfigListener(listenerID string) {
|
|
delete(s.listeners, listenerID)
|
|
}
|
|
|
|
func (s *StaticConfigService) AsymmetricSigningKey() *ecdsa.PrivateKey {
|
|
return &ecdsa.PrivateKey{}
|
|
}
|
|
|
|
func (s *StaticConfigService) PostActionCookieSecret() []byte {
|
|
return make([]byte, 32)
|
|
}
|
|
|
|
func (s *StaticConfigService) UpdateConfig(newConfig *model.Config) {
|
|
oldConfig := s.Config()
|
|
s.Cfg = newConfig
|
|
|
|
for _, listener := range s.listeners {
|
|
listener(oldConfig, newConfig)
|
|
}
|
|
}
|